diff src/quickfix.c @ 18646:394abd397e15 v8.1.2315

patch 8.1.2315: not always using the right window when jumping to an error Commit: https://github.com/vim/vim/commit/539aa6b25eaea91dfd1a175cd053c0f259fa2e58 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 17 18:09:38 2019 +0100 patch 8.1.2315: not always using the right window when jumping to an error Problem: Not always using the right window when jumping to an error. Solution: Add the "uselast" flag in 'switchbuf'. (closes https://github.com/vim/vim/issues/1652)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Nov 2019 18:15:03 +0100
parents fbeb1bf0cea8
children 022deb0adec9
line wrap: on
line diff
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -3013,8 +3013,11 @@ qf_goto_win_with_qfl_file(int qf_fnum)
 	if (IS_QF_WINDOW(win))
 	{
 	    // Didn't find it, go to the window before the quickfix
-	    // window.
-	    if (altwin != NULL)
+	    // window, unless 'switchbuf' contains 'uselast': in this case we
+	    // try to jump to the previously used window first.
+	    if ((swb_flags & SWB_USELAST) && win_valid(prevwin))
+		win = prevwin;
+	    else if (altwin != NULL)
 		win = altwin;
 	    else if (curwin->w_prev != NULL)
 		win = curwin->w_prev;