]> granicus.if.org Git - vim/commitdiff
patch 8.2.3163: location list window may open a wrong file v8.2.3163
authorWei-Chung Wen <morisato3711@gmail.com>
Thu, 15 Jul 2021 11:13:39 +0000 (13:13 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 15 Jul 2021 11:13:39 +0000 (13:13 +0200)
Problem:    Location list window may open a wrong file.
Solution:   Also update the qf_ptr field. (Wei-Chung Wen, closes #8565,
            closes #8566)

src/quickfix.c
src/testdir/test_quickfix.vim
src/version.c

index 4ac4a01a10f120e526f795e99e5ac54c8a2bf910..39424ca68061f6ad2c32d5fd5d402e1db63eb1a6 100644 (file)
@@ -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
index a6a20a8451cf9fc39f730084c0cbd075ffa6c076..e5a6d6cdbc384e89a467cf7f7f2bcbce18d95b8a 100644 (file)
@@ -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
index 341faea42db836204c161200219680c2ce8ad20a..edf5306f740be552550799abf8cf45e6f23c5c69 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3163,
 /**/
     3162,
 /**/