diff src/testdir/test_quickfix.vim @ 9114:f221aec7fcca v7.4.1841

commit https://github.com/vim/vim/commit/2b2b8ae5ab37b04584633c469265d85825166905 Author: Bram Moolenaar <Bram@vim.org> Date: Tue May 24 19:59:51 2016 +0200 patch 7.4.1841 Problem: The code to reallocate the buffer used for quickfix is repeated. Solution: Move the code to a function. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/831)
author Christian Brabandt <cb@256bit.org>
date Tue, 24 May 2016 20:00:08 +0200
parents 0536d1469b67
children 7350959e53c3
line wrap: on
line diff
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -700,14 +700,14 @@ endfunc
 
 " Tests for the setqflist() and setloclist() functions
 function SetXlistTests(cchar, bnum)
+  let Xwindow = a:cchar . 'window'
+  let Xnext = a:cchar . 'next'
   if a:cchar == 'c'
     let Xsetlist = function('setqflist')
     let Xgetlist = function('getqflist')
-    let Xnext = 'cnext'
   else
     let Xsetlist = function('setloclist', [0])
     let Xgetlist = function('getloclist', [0])
-    let Xnext = 'lnext'
   endif
 
   call Xsetlist([{'bufnr': a:bnum, 'lnum': 1},
@@ -723,6 +723,15 @@ function SetXlistTests(cchar, bnum)
   exe Xnext
   call assert_equal(3, line('.'))
 
+  " Appending entries to the list should not change the cursor position
+  " in the quickfix window
+  exe Xwindow
+  1
+  call Xsetlist([{'bufnr': a:bnum, 'lnum': 4},
+	      \  {'bufnr': a:bnum, 'lnum': 5}], 'a')
+  call assert_equal(1, line('.'))
+  close
+
   call Xsetlist([{'bufnr': a:bnum, 'lnum': 3},
 	      \  {'bufnr': a:bnum, 'lnum': 4},
 	      \  {'bufnr': a:bnum, 'lnum': 5}], 'r')