diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-04-08 11:11:38 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2025-04-08 13:06:19 +0800 |
commit | 00eff4b196521adc35d11c605decacef5bc98fa3 (patch) | |
tree | 200724f2187c38977316e06c810bb323736bb918 /test | |
parent | 36d143e70722848855107ff05ab3997857b0c388 (diff) | |
download | rneovim-00eff4b196521adc35d11c605decacef5bc98fa3.tar.gz rneovim-00eff4b196521adc35d11c605decacef5bc98fa3.tar.bz2 rneovim-00eff4b196521adc35d11c605decacef5bc98fa3.zip |
vim-patch:9.1.1283: quickfix stack is limited to 10 items
Problem: quickfix and location-list stack is limited to 10 items
Solution: add the 'chistory' and 'lhistory' options to configure a
larger quickfix/location list stack
(64-bitman)
closes: vim/vim#16920
https://github.com/vim/vim/commit/88d41ab270a8390a43da97a903b1a4d76b89d330
Co-authored-by: 64-bitman <60551350+64-bitman@users.noreply.github.com>
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/gen_opt_test.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_quickfix.vim | 173 |
2 files changed, 175 insertions, 0 deletions
diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index fb0af3de0a..01c7d88464 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -106,6 +106,7 @@ let test_values = { \ []], \ "\ number options + \ 'chistory': [[1, 2, 10, 50], [1000, -1]], \ 'cmdheight': [[0, 1, 2, 10], [-1]], \ 'cmdwinheight': [[1, 2, 10], [-1, 0]], \ 'columns': [[12, 80, 10000], [-1, 0, 10]], @@ -116,6 +117,7 @@ let test_values = { "\ 'iminsert': [[0, 1, 2], [-1, 3, 999]], "\ 'imsearch': [[-1, 0, 1, 2], [-2, 3, 999]], "\ 'imstyle': [[0, 1], [-1, 2, 999]], + \ 'lhistory': [[1, 2, 10, 50], [1000, -1]], \ 'lines': [[2, 24, 1000], [-1, 0, 1]], \ 'linespace': [[-1, 0, 2, 4, 999], ['']], \ 'numberwidth': [[1, 4, 8, 10, 11, 20], [-1, 0, 21]], diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim index 0d2dd24e0a..ced6c8d7bd 100644 --- a/test/old/testdir/test_quickfix.vim +++ b/test/old/testdir/test_quickfix.vim @@ -43,6 +43,8 @@ func s:setup_commands(cchar) command! -count=1 -nargs=0 Xabove <mods><count>cabove command! -count=1 -nargs=0 Xbefore <mods><count>cbefore command! -count=1 -nargs=0 Xafter <mods><count>cafter + command! -nargs=1 Xsethist <mods>set chistory=<args> + command! -nargs=0 Xsethistdefault <mods>set chistory& let g:Xgetlist = function('getqflist') let g:Xsetlist = function('setqflist') call setqflist([], 'f') @@ -80,6 +82,9 @@ func s:setup_commands(cchar) command! -count=1 -nargs=0 Xabove <mods><count>labove command! -count=1 -nargs=0 Xbefore <mods><count>lbefore command! -count=1 -nargs=0 Xafter <mods><count>lafter + command! -nargs=1 Xsethist <mods>set lhistory=<args> + command! -nargs=1 Xsetlocalhist <mods>setlocal lhistory=<args> + command! -nargs=0 Xsethistdefault <mods>set lhistory& let g:Xgetlist = function('getloclist', [0]) let g:Xsetlist = function('setloclist', [0]) call setloclist(0, [], 'f') @@ -6596,6 +6601,174 @@ func Test_hardlink_fname() call Xtest_hardlink_fname('l') endfunc +" Test for checking if correct number of tests are deleted +" and current list stays the same after setting Xhistory +" to a smaller number. Do roughly the same for growing the stack. +func Xtest_resize_list_stack(cchar) + call s:setup_commands(a:cchar) + Xsethist 100 + + for i in range(1, 100) + Xexpr string(i) + endfor + Xopen + call assert_equal(g:Xgetlist({'nr': '$'}).nr, 100) + call assert_equal("|| 100", getline(1)) + Xsethist 8 + call assert_equal("|| 100", getline(1)) + Xolder 5 + call assert_equal("|| 95", getline(1)) + Xsethist 6 + call assert_equal("|| 95", getline(1)) + Xsethist 1 + call assert_equal("|| 100", getline(1)) + + " grow array again + Xsethist 100 + for i in range(1, 99) + Xexpr string(i) + endfor + call assert_equal("|| 99", getline(1)) + Xolder 99 + call assert_equal("|| 100", getline(1)) + + Xsethistdefault +endfunc + +func Test_resize_list_stack() + call Xtest_resize_list_stack('c') + call Xtest_resize_list_stack('l') +endfunc + +" Test to check if order of lists is from +" oldest at the bottom to newest at the top +func Xtest_Xhistory_check_order(cchar) + + Xsethist 100 + + for i in range(1, 100) + Xexpr string(i) + endfor + + Xopen + for i in range(100, 1, -1) + let l:ret = assert_equal("|| " .. i, getline(1)) + + if ret == 1 || i == 1 + break + endif + Xolder + endfor + + for i in range(1, 50) + Xexpr string(i) + endfor + + for i in range(50, 1, -1) + let l:ret = assert_equal("|| " .. i, getline(1)) + + if ret == 1 || i == 50 + break + endif + Xolder + endfor + + for i in range(50, 1, -1) + let l:ret = assert_equal("|| " .. i, getline(1)) + + if ret == 1 || i == 50 + break + endif + Xolder + endfor + + Xsethistdefault +endfunc + +func Test_set_history_to_check_order() + call Xtest_Xhistory_check_order('c') + call Xtest_Xhistory_check_order('l') +endfunc + +" Check if 'lhistory' is the same between the location list window +" and associated normal window +func Test_win_and_loc_synced() + new + set lhistory=2 + lexpr "Text" + lopen + + " check if lhistory is synced when modified inside the + " location list window + setlocal lhistory=1 + wincmd k + call assert_equal(&lhistory, 1) + + " check if lhistory is synced when modified inside the + " normal window + setlocal lhistory=10 + lopen + call assert_equal(&lhistory, 10) + + wincmd k + lclose + wincmd q + + set lhistory& +endfunc + +" Test if setting the lhistory of one window doesn't affect the other +func Test_two_win_are_independent_of_history() + setlocal lhistory=10 + new + setlocal lhistory=20 + wincmd w + call assert_equal(&lhistory, 10) + wincmd w + wincmd q + + set lhistory& +endfunc + +" Test if lhistory is copied over to a new window +func Test_lhistory_copied_over() + setlocal lhistory=3 + split + call assert_equal(&lhistory, 3) + wincmd q + + set lhistory& +endfunc + +" Test if error occurs when given invalid history number +func Xtest_invalid_history_num(cchar) + call s:setup_commands(a:cchar) + + call assert_fails('Xsethist -10000', "E1542:") + call assert_fails('Xsethist 10000', "E1543:") + Xsethistdefault +endfunc + +func Test_invalid_history_num() + call Xtest_invalid_history_num('c') + call Xtest_invalid_history_num('l') +endfunc + +" Test if chistory and lhistory don't affect each other +func Test_chi_and_lhi_are_independent() + set chistory=100 + set lhistory=100 + + set chistory=10 + call assert_equal(&lhistory, 100) + + set lhistory=1 + call assert_equal(&chistory, 10) + + set chistory& + set lhistory& +endfunc + func Test_quickfix_close_buffer_crash() new lexpr 'test' | lopen |