aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-07-31 14:16:22 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-07-31 15:10:50 -0400
commit8738ce8c41dc8b341202ddcf9f25459c3d6107d9 (patch)
tree9062d868e9371886e4f1f8e2177e349228f1b559
parent64ad770fbe387060ece5ebde786921bff65c30e6 (diff)
downloadrneovim-8738ce8c41dc8b341202ddcf9f25459c3d6107d9.tar.gz
rneovim-8738ce8c41dc8b341202ddcf9f25459c3d6107d9.tar.bz2
rneovim-8738ce8c41dc8b341202ddcf9f25459c3d6107d9.zip
vim-patch:8.2.3163: location list window may open a wrong file
Problem: Location list window may open a wrong file. Solution: Also update the qf_ptr field. (Wei-Chung Wen, closes vim/vim#8565, closes vim/vim#8566) https://github.com/vim/vim/commit/1557b16dad2b1a3466a93d015575cd7fdb4661c9
-rw-r--r--src/nvim/quickfix.c1
-rw-r--r--src/nvim/testdir/test_quickfix.vim33
2 files changed, 34 insertions, 0 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index d09dfac840..0cfb7c192f 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -3014,6 +3014,7 @@ static void qf_jump_newwin(qf_info_T *qi, int dir, int errornr, int forceit,
}
qfl->qf_index = qf_index;
+ qfl->qf_ptr = qf_ptr;
if (qf_win_pos_update(qi, old_qf_index)) {
// No need to print the error message if it's visible in the error
// window
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 73b7fa69e7..5cfea483e2 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -5258,4 +5258,37 @@ func Test_qftextfunc_other_loclist()
%bw!
endfunc
+func Test_locationlist_open_in_newtab()
+ call s:create_test_file('Xqftestfile1')
+ call s:create_test_file('Xqftestfile2')
+ call s:create_test_file('Xqftestfile3')
+
+ %bwipe!
+
+ lgetexpr ['Xqftestfile1:5:Line5',
+ \ 'Xqftestfile2:10:Line10',
+ \ 'Xqftestfile3:16:Line16']
+
+ silent! llast
+ call assert_equal(1, tabpagenr('$'))
+ call assert_equal('Xqftestfile3', bufname())
+
+ set switchbuf=newtab
+
+ silent! lfirst
+ call assert_equal(2, tabpagenr('$'))
+ call assert_equal('Xqftestfile1', bufname())
+
+ silent! lnext
+ call assert_equal(3, tabpagenr('$'))
+ call assert_equal('Xqftestfile2', bufname())
+
+ call delete('Xqftestfile1')
+ call delete('Xqftestfile2')
+ call delete('Xqftestfile3')
+ set switchbuf&vim
+
+ %bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab