# HG changeset patch # User Bram Moolenaar # Date 1626347703 -7200 # Node ID 5127844b909b04ecd70ff7e19081e34722e081cc # Parent ec854d8faa6bb659dec249a97fddff7cfd41949d patch 8.2.3163: location list window may open a wrong file Commit: https://github.com/vim/vim/commit/1557b16dad2b1a3466a93d015575cd7fdb4661c9 Author: Wei-Chung Wen Date: Thu Jul 15 13:13:39 2021 +0200 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 https://github.com/vim/vim/issues/8565, closes #8566) diff --git a/src/quickfix.c b/src/quickfix.c --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3461,6 +3461,7 @@ qf_jump_newwin(qf_info_T *qi, } 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/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -5554,4 +5554,37 @@ func Test_vimgrep_fuzzy_match() call delete('Xfile2') 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 diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3163, +/**/ 3162, /**/ 3161,