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 #1652)
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index a306133..0744364 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -1664,6 +1664,14 @@
call assert_equal(3, tabpagenr('$'))
tabfirst | enew | tabonly | only
+ set switchbuf=uselast
+ split
+ let last_winid = win_getid()
+ copen
+ exe "normal 1G\<CR>"
+ call assert_equal(last_winid, win_getid())
+ enew | only
+
set switchbuf=
edit Xqftestfile1
let file1_winid = win_getid()