From c8dc34795b552ac69183e803bfff474ba4e595b6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 22:23:02 +0800 Subject: vim-patch:9.0.0064: confusing error when using "q:" in command line window Problem: Confusing error when using "q:" in command line window. Solution: Check for the situation and give a better error message. (closes vim/vim#10756) https://github.com/vim/vim/commit/c963ec31a0c293d629e40cb082d4bfb1651def49 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_cmdwin.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/old/testdir/test_cmdwin.vim (limited to 'test') diff --git a/test/old/testdir/test_cmdwin.vim b/test/old/testdir/test_cmdwin.vim new file mode 100644 index 0000000000..ef334c774f --- /dev/null +++ b/test/old/testdir/test_cmdwin.vim @@ -0,0 +1,17 @@ +" Tests for editing the command line. + +source check.vim +source screendump.vim + + +func Test_cant_open_cmdwin_in_cmdwin() + try + call feedkeys("q:q::q\", "x!") + catch + let caught = v:exception + endtry + call assert_match('E1292:', caught) +endfunc + + +" vim: shiftwidth=2 sts=2 expandtab -- cgit From 4111530806741bc25bd426ec9b7e9340bdd57991 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 22:26:53 +0800 Subject: vim-patch:9.0.0218: reading before the start of the line Problem: Reading before the start of the line. Solution: When displaying "$" check the column is not negative. https://github.com/vim/vim/commit/e98c88c44c308edaea5994b8ad4363e65030968c Co-authored-by: Bram Moolenaar --- test/old/testdir/test_cmdwin.vim | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_cmdwin.vim b/test/old/testdir/test_cmdwin.vim index ef334c774f..14170fbb13 100644 --- a/test/old/testdir/test_cmdwin.vim +++ b/test/old/testdir/test_cmdwin.vim @@ -13,5 +13,13 @@ func Test_cant_open_cmdwin_in_cmdwin() call assert_match('E1292:', caught) endfunc +func Test_cmdwin_virtual_edit() + enew! + set ve=all cpo+=$ + silent normal q/s + + set ve= cpo-=$ +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From f80cf0f84f6e39dc3dfd1697eb911ac28b6ec97d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 22:28:34 +0800 Subject: vim-patch:9.0.0249: no test for what 9.0.0234 fixes Problem: No test for what 9.0.0234 fixes. Solution: Add a test. (issue vim/vim#10950) https://github.com/vim/vim/commit/3a7ad904d27d904e57f7a22eb33872a587ae6673 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_cmdwin.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_cmdwin.vim b/test/old/testdir/test_cmdwin.vim index 14170fbb13..e54945f1b6 100644 --- a/test/old/testdir/test_cmdwin.vim +++ b/test/old/testdir/test_cmdwin.vim @@ -21,5 +21,12 @@ func Test_cmdwin_virtual_edit() set ve= cpo-=$ endfunc +" Check that a :normal command can be used to stop Visual mode without side +" effects. +func Test_normal_escape() + call feedkeys("q:i\" foo\:normal! \\\:\" bar\", 'ntx') + call assert_equal('" bar', @:) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 7eea6b12f98c4319d2f358ee1c1ebd3f5b2dfa62 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 22:29:07 +0800 Subject: vim-patch:9.0.0490: using freed memory with cmdwin and BufEnter autocmd Problem: Using freed memory with cmdwin and BufEnter autocmd. Solution: Make sure pointer to b_p_iminsert is still valid. https://github.com/vim/vim/commit/1c3dd8ddcba63c1af5112e567215b3cec2de11d0 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_cmdwin.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_cmdwin.vim b/test/old/testdir/test_cmdwin.vim index e54945f1b6..e53dd1cb6f 100644 --- a/test/old/testdir/test_cmdwin.vim +++ b/test/old/testdir/test_cmdwin.vim @@ -28,5 +28,15 @@ func Test_normal_escape() call assert_equal('" bar', @:) endfunc +" This was using a pointer to a freed buffer +func Test_cmdwin_freed_buffer_ptr() + au BufEnter * next 0| file + edit 0 + silent! norm q/ + + au! BufEnter + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 2de3362ce3877b622a26c21214c95c69892b8c63 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 22:38:54 +0800 Subject: vim-patch:9.0.0492: cmdwin test fails on MS-Windows Problem: Cmdwin test fails on MS-Windows. Solution: Skip test on MS-Windows. https://github.com/vim/vim/commit/312af65d1ac763c060cb5adfcf8ae5beeec97f59 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_cmdwin.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_cmdwin.vim b/test/old/testdir/test_cmdwin.vim index e53dd1cb6f..4284f0f58d 100644 --- a/test/old/testdir/test_cmdwin.vim +++ b/test/old/testdir/test_cmdwin.vim @@ -30,6 +30,9 @@ endfunc " This was using a pointer to a freed buffer func Test_cmdwin_freed_buffer_ptr() + " this does not work on MS-Windows because renaming an open file fails + CheckNotMSWindows + au BufEnter * next 0| file edit 0 silent! norm q/ -- cgit From cd9ca700e5053f8a9666c917310dcc39651e3bfa Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 13 May 2023 22:39:28 +0800 Subject: vim-patch:9.0.0598: using negative array index with negative width window Problem: Using negative array index with negative width window. Solution: Make sure the window width does not become negative. https://github.com/vim/vim/commit/8279af514ca7e5fd3c31cf13b0864163d1a0bfeb Co-authored-by: Bram Moolenaar --- test/old/testdir/test_cmdwin.vim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_cmdwin.vim b/test/old/testdir/test_cmdwin.vim index 4284f0f58d..f948d46be1 100644 --- a/test/old/testdir/test_cmdwin.vim +++ b/test/old/testdir/test_cmdwin.vim @@ -41,5 +41,27 @@ func Test_cmdwin_freed_buffer_ptr() bwipe! endfunc +" This was resulting in a window with negative width. +" The test doesn't reproduce the illegal memory access though... +func Test_cmdwin_split_often() + let lines = &lines + let columns = &columns + set t_WS= + + try + " set encoding=iso8859 + set ruler + winsize 0 0 + noremap 0 H + sil norm 0000000q: + catch /E36:/ + endtry + + bwipe! + set encoding=utf8 + let &lines = lines + let &columns = columns +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit