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') 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 0ae47000e060ad21896c0bb434e99d9a7d8c02b9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 5 Oct 2022 21:18:13 +0800 Subject: vim-patch:8.2.2421: double free when using autocommand with "argdel" Problem: Double free when using autocommand with "argdel". (Houyunsong) Solution: Add the arglist_locked flag. https://github.com/vim/vim/commit/5ed58c7b700fcb9fd03c418300145b616f4bdcdd --- src/nvim/testdir/test_autocmd.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index d766256d4b..07042eab32 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -148,6 +148,12 @@ func Test_autocmd_bufunload_with_tabnext() quit endfunc +func Test_argdelete_in_next() + au BufNew,BufEnter,BufLeave,BufWinEnter * argdel + call assert_fails('next a b', 'E1156:') + au! BufNew,BufEnter,BufLeave,BufWinEnter * +endfunc + func Test_autocmd_bufwinleave_with_tabfirst() tabedit augroup sample -- cgit From a66b12378b1431f886c9b4235160abb171bcb05a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 5 Oct 2022 21:33:08 +0800 Subject: vim-patch:8.2.2463: using :arglocal in an autocommand may use freed memory Problem: Using :arglocal in an autocommand may use freed memory. (houyunsong) Solution: Check if the arglist is locked. https://github.com/vim/vim/commit/6bcb877ec19a647443195a54eeac60cb693fd827 --- src/nvim/testdir/test_autocmd.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 07042eab32..c320d3ca78 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -3010,6 +3010,15 @@ func Test_Visual_doautoall_redraw() %bwipe! endfunc +" This was using freed memory. +func Test_BufNew_arglocal() + arglocal + au BufNew * arglocal + call assert_fails('drop xx', 'E1156:') + + au! BufNew +endfunc + func Test_autocmd_closes_window() au BufNew,BufWinLeave * e %e file yyy -- 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') 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') 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 +- src/nvim/testdir/test_autocmd.vim | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') 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 diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index c320d3ca78..025bda4515 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -2054,6 +2054,7 @@ endfunc func Test_autocommand_all_events() call assert_fails('au * * bwipe', 'E1155:') call assert_fails('au * x bwipe', 'E1155:') + call assert_fails('au! * x bwipe', 'E1155:') endfunc func Test_autocmd_user() -- cgit