From c64acad4e2d4c8c05404f05dd149da9d34960a3d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 5 Oct 2022 21:14:03 +0800 Subject: vim-patch:8.2.2413: crash when using :all while using a cmdline window Problem: Crash when using :all while using a cmdline window. (Zdenek Dohnal) Solution: Disallow :all from the cmdline window. https://github.com/vim/vim/commit/bb4b93ed85726c3921596ca267f531c8c94d819a Use test from lastest Vim instead. --- src/nvim/testdir/test_arglist.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/nvim/testdir/test_arglist.vim') diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 521c3fcd57..19b64f996c 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -591,4 +591,20 @@ func Test_quit_with_arglist() call delete('.c.swp') endfunc +" Test for ":all" not working when in the cmdline window +func Test_all_not_allowed_from_cmdwin() + au BufEnter * all + next x + " Use try/catch here, somehow assert_fails() doesn't work on MS-Windows + " console. + let caught = 'no' + try + exe ":norm! 7q?apat\" + catch /E11:/ + let caught = 'yes' + endtry + call assert_equal('yes', caught) + au! BufEnter +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From dcdb7dca6aa7e335b2e8f339d3bb76da1c9d3b6e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 5 Oct 2022 21:27:58 +0800 Subject: vim-patch:8.2.3884: crash when clearing the argument list while using it Problem: Crash when clearing the argument list while using it. Solution: Lock the argument list for ":all". https://github.com/vim/vim/commit/6f98371532fcff911b462d51bc64f2ce8a6ae682 --- src/nvim/testdir/test_arglist.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/testdir/test_arglist.vim') diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 19b64f996c..b1edb66a02 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -607,4 +607,11 @@ func Test_all_not_allowed_from_cmdwin() au! BufEnter endfunc +func Test_clear_arglist_in_all() + n 0 00 000 0000 00000 000000 + au! * 0 n 0 + all + au! * +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 824a31cd0d55752b01a9bdd1f38f756e079e25e8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 5 Oct 2022 21:29:56 +0800 Subject: vim-patch:8.2.3885: arglist test fails Problem: Arglist test fails. Solution: Adjust for locking the arglist for ":all". https://github.com/vim/vim/commit/679140c56bbabf12a199d94f584b1b9dfc9809fd --- src/nvim/testdir/test_arglist.vim | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/nvim/testdir/test_arglist.vim') diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index b1edb66a02..1fa31b6ecc 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -509,18 +509,14 @@ func Test_arglist_autocmd() new " redefine arglist; go to Xxx1 next! Xxx1 Xxx2 Xxx3 - " open window for all args; Reading Xxx2 will change the arglist and the - " third window will get Xxx1: - " win 1: Xxx1 - " win 2: Xxx2 - " win 3: Xxx1 - all + " open window for all args; Reading Xxx2 will try to change the arglist and + " that will fail + call assert_fails("all", "E1156:") call assert_equal('test file Xxx1', getline(1)) wincmd w - wincmd w - call assert_equal('test file Xxx1', getline(1)) - rewind call assert_equal('test file Xxx2', getline(1)) + wincmd w + call assert_equal('test file Xxx3', getline(1)) autocmd! BufReadPost Xxx2 enew! | only @@ -610,7 +606,7 @@ endfunc func Test_clear_arglist_in_all() n 0 00 000 0000 00000 000000 au! * 0 n 0 - all + call assert_fails("all", "E1156") au! * endfunc -- cgit From 42afb9153a8380fdbace81c86f789e7b8af2c65c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 5 Oct 2022 21:30:25 +0800 Subject: vim-patch:8.2.3886: can define autocmd for every event by using "au!" Problem: Can define autocmd for every event by using "au!". Solution: Check if a command is present also for "au!". https://github.com/vim/vim/commit/b6db1467622be046dbf00b2213fd9f49f4f3cccb --- src/nvim/testdir/test_arglist.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/testdir/test_arglist.vim') diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 1fa31b6ecc..c01ae87fd8 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -605,7 +605,7 @@ endfunc func Test_clear_arglist_in_all() n 0 00 000 0000 00000 000000 - au! * 0 n 0 + au WinNew 0 n 0 call assert_fails("all", "E1156") au! * endfunc -- cgit From 4bfbac05c9d4d923da12a50b3a89161dedc2111b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 6 Oct 2022 12:50:34 +0800 Subject: vim-patch:9.0.0422: not enough testing of the :all command (#20503) Problem: Not enough testing of the :all command. Solution: Add more testing. (Yegappan Lakshmanan, closes vim/vim#11091) https://github.com/vim/vim/commit/0dc2fd307ffc223cf010d1fdea6e3d5c4524d43c --- src/nvim/testdir/test_arglist.vim | 126 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) (limited to 'src/nvim/testdir/test_arglist.vim') diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index c01ae87fd8..0fd65e8f5a 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -610,4 +610,130 @@ func Test_clear_arglist_in_all() au! * endfunc +" Test for the :all command +func Test_all_command() + %argdelete + + " :all command should not close windows with files in the argument list, + " but can rearrange the windows. + args Xargnew1 Xargnew2 + %bw! + edit Xargold1 + split Xargnew1 + let Xargnew1_winid = win_getid() + split Xargold2 + split Xargnew2 + let Xargnew2_winid = win_getid() + split Xargold3 + all + call assert_equal(2, winnr('$')) + call assert_equal([Xargnew1_winid, Xargnew2_winid], + \ [win_getid(1), win_getid(2)]) + call assert_equal([bufnr('Xargnew1'), bufnr('Xargnew2')], + \ [winbufnr(1), winbufnr(2)]) + + " :all command should close windows for files which are not in the + " argument list in the current tab page. + %bw! + edit Xargold1 + split Xargold2 + tabedit Xargold3 + split Xargold4 + tabedit Xargold5 + tabfirst + all + call assert_equal(3, tabpagenr('$')) + call assert_equal([bufnr('Xargnew1'), bufnr('Xargnew2')], tabpagebuflist(1)) + call assert_equal([bufnr('Xargold4'), bufnr('Xargold3')], tabpagebuflist(2)) + call assert_equal([bufnr('Xargold5')], tabpagebuflist(3)) + + " :tab all command should close windows for files which are not in the + " argument list across all the tab pages. + %bw! + edit Xargold1 + split Xargold2 + tabedit Xargold3 + split Xargold4 + tabedit Xargold5 + tabfirst + args Xargnew1 Xargnew2 + tab all + call assert_equal(2, tabpagenr('$')) + call assert_equal([bufnr('Xargnew1')], tabpagebuflist(1)) + call assert_equal([bufnr('Xargnew2')], tabpagebuflist(2)) + + " If a count is specified, then :all should open only that many windows. + %bw! + args Xargnew1 Xargnew2 Xargnew3 Xargnew4 Xargnew5 + all 3 + call assert_equal(3, winnr('$')) + call assert_equal([bufnr('Xargnew1'), bufnr('Xargnew2'), bufnr('Xargnew3')], + \ [winbufnr(1), winbufnr(2), winbufnr(3)]) + + " The :all command should not open more than 'tabpagemax' tab pages. + " If there are more files, then they should be opened in the last tab page. + %bw! + set tabpagemax=3 + tab all + call assert_equal(3, tabpagenr('$')) + call assert_equal([bufnr('Xargnew1')], tabpagebuflist(1)) + call assert_equal([bufnr('Xargnew2')], tabpagebuflist(2)) + call assert_equal([bufnr('Xargnew3'), bufnr('Xargnew4'), bufnr('Xargnew5')], + \ tabpagebuflist(3)) + set tabpagemax& + + " Without the 'hidden' option, modified buffers should not be closed. + args Xargnew1 Xargnew2 + %bw! + edit Xargtemp1 + call setline(1, 'temp buffer 1') + split Xargtemp2 + call setline(1, 'temp buffer 2') + all + call assert_equal(4, winnr('$')) + call assert_equal([bufnr('Xargtemp2'), bufnr('Xargtemp1'), bufnr('Xargnew1'), + \ bufnr('Xargnew2')], + \ [winbufnr(1), winbufnr(2), winbufnr(3), winbufnr(4)]) + + " With the 'hidden' option set, both modified and unmodified buffers in + " closed windows should be hidden. + set hidden + all + call assert_equal(2, winnr('$')) + call assert_equal([bufnr('Xargnew1'), bufnr('Xargnew2')], + \ [winbufnr(1), winbufnr(2)]) + call assert_equal([1, 1, 0, 0], [getbufinfo('Xargtemp1')[0].hidden, + \ getbufinfo('Xargtemp2')[0].hidden, + \ getbufinfo('Xargnew1')[0].hidden, + \ getbufinfo('Xargnew2')[0].hidden]) + set nohidden + + " When 'winheight' is set to a large value, :all should open only one + " window. + args Xargnew1 Xargnew2 Xargnew3 Xargnew4 Xargnew5 + %bw! + set winheight=9999 + call assert_fails('all', 'E36:') + call assert_equal([1, bufnr('Xargnew1')], [winnr('$'), winbufnr(1)]) + set winheight& + + " When 'winwidth' is set to a large value, :vert all should open only one + " window. + %bw! + set winwidth=9999 + call assert_fails('vert all', 'E36:') + call assert_equal([1, bufnr('Xargnew1')], [winnr('$'), winbufnr(1)]) + set winwidth& + + " empty argument list tests + %bw! + %argdelete + call assert_equal('', execute('args')) + all + call assert_equal(1, winnr('$')) + + %argdelete + %bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 1887d8d7d0dd619fa90fe11182c436bc3c71c9d5 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 23 Oct 2022 03:45:39 +0200 Subject: docs: fix typos (#20724) Co-authored-by: Marco Lehmann --- src/nvim/testdir/test_arglist.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/testdir/test_arglist.vim') diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 0fd65e8f5a..443a217143 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -550,7 +550,7 @@ func Test_argdo() bwipe Xa.c Xb.c Xc.c endfunc -" Test for quiting Vim with unedited files in the argument list +" Test for quitting Vim with unedited files in the argument list func Test_quit_with_arglist() if !CanRunVimInTerminal() throw 'Skipped: cannot run vim in terminal' -- cgit From 40ca9b9528e5a4f043f0e6858786bf0c3d992a90 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 5 Nov 2022 08:07:06 +0800 Subject: vim-patch:8.2.0866: not enough tests for buffer writing Problem: Not enough tests for buffer writing. Solution: Add more tests. Use CheckRunVimInTerminal in more places. (Yegappan Lakshmanan, closes vim/vim#6167) https://github.com/vim/vim/commit/494e9069cb32620f7688a7cb128a3feff827639e --- src/nvim/testdir/test_arglist.vim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/nvim/testdir/test_arglist.vim') diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 443a217143..cae71e10f3 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -1,5 +1,6 @@ " Test argument list commands +source check.vim source shared.vim source term_util.vim @@ -552,9 +553,7 @@ endfunc " Test for quitting Vim with unedited files in the argument list func Test_quit_with_arglist() - if !CanRunVimInTerminal() - throw 'Skipped: cannot run vim in terminal' - endif + CheckRunVimInTerminal let buf = RunVimInTerminal('', {'rows': 6}) call term_sendkeys(buf, ":set nomore\n") call term_sendkeys(buf, ":args a b c\n") -- cgit From 9d7dc5062877bd7e035f1f7a74e2462c2e942864 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 13 Nov 2022 08:35:15 +0800 Subject: vim-patch:9.0.0865: duplicate arguments are not always detected (#21036) Problem: Duplicate arguments are not always detected. Solution: Expand to full path before comparing arguments. (Nir Lichtman, closes vim/vim#11505, closes vim/vim#9402) https://github.com/vim/vim/commit/b3052aa1b555ab5a81b1459a4972290381b0e7e4 Co-authored-by: Nir Lichtman --- src/nvim/testdir/test_arglist.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/testdir/test_arglist.vim') diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index cae71e10f3..fb8b17cd16 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -418,15 +418,19 @@ func Test_argdedupe() call Reset_arglist() argdedupe call assert_equal([], argv()) + args a a a aa b b a b aa argdedupe call assert_equal(['a', 'aa', 'b'], argv()) + args a b c argdedupe call assert_equal(['a', 'b', 'c'], argv()) + args a argdedupe call assert_equal(['a'], argv()) + args a A b B argdedupe if has('fname_case') @@ -434,11 +438,17 @@ func Test_argdedupe() else call assert_equal(['a', 'b'], argv()) endif + args a b a c a b last argdedupe next call assert_equal('c', expand('%:t')) + + args a ./a + argdedupe + call assert_equal(['a'], argv()) + %argd endfunc -- cgit