From 1fe1bb084d0099fc4f9bfdc11189485d0f74b75a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 19 Dec 2022 16:37:45 +0000 Subject: refactor(options): deprecate nvim[_buf|_win]_[gs]et_option Co-authored-by: zeertzjq Co-authored-by: famiu --- test/functional/legacy/messages_spec.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/functional/legacy/messages_spec.lua') diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index 71a53c8381..794676153c 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -361,9 +361,9 @@ describe('messages', function() screen:attach() command('cd '..nvim_dir) - meths.set_option('shell', './shell-test') - meths.set_option('shellcmdflag', 'REP 20') - meths.set_option('shellxquote', '') -- win: avoid extra quotes + meths.set_option_value('shell', './shell-test', {}) + meths.set_option_value('shellcmdflag', 'REP 20', {}) + meths.set_option_value('shellxquote', '', {}) -- win: avoid extra quotes -- display a page and go back, results in exactly the same view feed([[:4 verbose echo system('foo')]]) -- cgit From cba07dad494558a4a06e25a35521041864697be3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 16 Jun 2023 08:01:43 +0800 Subject: vim-patch:9.0.1634: message is cleared when removing mode message Problem: Message is cleared when removing mode message (Gary Johnson). Solution: Do not clear the command line after displaying a message. https://github.com/vim/vim/commit/800cdbb7caeb5dd4379c6cb071bb12391f20bcf3 Co-authored-by: Bram Moolenaar --- test/functional/legacy/messages_spec.lua | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'test/functional/legacy/messages_spec.lua') diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index 794676153c..0a4d418e9c 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -49,6 +49,54 @@ describe('messages', function() ]]) end) + -- oldtest: Test_message_not_cleared_after_mode() + it('clearing mode does not remove message', function() + screen = Screen.new(60, 10) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + }) + screen:attach() + exec([[ + nmap gx :call DebugSilent('normal') + vmap gx :call DebugSilent('visual') + function DebugSilent(arg) + echomsg "from DebugSilent" a:arg + endfunction + set showmode + set cmdheight=1 + call setline(1, ['one', 'two', 'three']) + ]]) + + feed('gx') + screen:expect([[ + ^one | + two | + three | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + from DebugSilent normal | + ]]) + + -- removing the mode message used to also clear the intended message + feed('vEgx') + screen:expect([[ + ^one | + two | + three | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + from DebugSilent visual | + ]]) + end) + describe('more prompt', function() before_each(function() command('set more') -- cgit From 11060793d6544e893f31d65e8f964453c463407c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 16 Jun 2023 08:13:42 +0800 Subject: vim-patch:9.0.1635: error message is cleared when removing mode message Problem: Error message is cleared when removing mode message. Solution: Also reset flags when the message is further down. https://github.com/vim/vim/commit/da51ad51bf4fbd66619786d0e6a83fb3ca09930b Co-authored-by: Bram Moolenaar --- test/functional/legacy/messages_spec.lua | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'test/functional/legacy/messages_spec.lua') diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index 0a4d418e9c..a604e68822 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -54,6 +54,7 @@ describe('messages', function() screen = Screen.new(60, 10) screen:set_default_attr_ids({ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg }) screen:attach() exec([[ @@ -64,13 +65,13 @@ describe('messages', function() endfunction set showmode set cmdheight=1 - call setline(1, ['one', 'two', 'three']) + call setline(1, ['one', 'NoSuchFile', 'three']) ]]) feed('gx') screen:expect([[ ^one | - two | + NoSuchFile | three | {0:~ }| {0:~ }| @@ -85,7 +86,7 @@ describe('messages', function() feed('vEgx') screen:expect([[ ^one | - two | + NoSuchFile | three | {0:~ }| {0:~ }| @@ -95,6 +96,22 @@ describe('messages', function() {0:~ }| from DebugSilent visual | ]]) + + -- removing the mode message used to also clear the error message + command('set cmdheight=2') + feed('2GvEgf') + screen:expect([[ + one | + NoSuchFil^e | + three | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + from DebugSilent visual | + {1:E447: Can't find file "NoSuchFile" in path} | + ]]) end) describe('more prompt', function() -- cgit From 3ab0e296c674a6846512df24a0a70199bba8c59a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 17 Nov 2023 09:33:54 +0800 Subject: vim-patch:9.0.1969: [security] buffer-overflow in trunc_string() Problem: buffer-overflow in trunc_string() Solution: Add NULL at end of buffer Currently trunc_string() assumes that when the string is too long, buf[e-1] will always be writeable. But that assumption may not always be true. The condition currently looks like this else if (e + 3 < buflen) [...] else { // can't fit in the "...", just truncate it buf[e - 1] = NUL; } but this means, we may run into the last else clause with e still being larger than buflen. So a buffer overflow occurs. So instead of using `buf[e - 1]`, let's just always truncate at `buf[buflen - 1]` which should always be writable. https://github.com/vim/vim/commit/3bd7fa12e146c6051490d048a4acbfba974eeb04 vim-patch:9.0.2004: Missing test file Problem: Missing test file Solution: git-add the file to the repo closes: vim/vim#13305 https://github.com/vim/vim/commit/d4afbdd0715c722cfc73d3a8ab9e578667615faa Co-authored-by: Christian Brabandt --- test/functional/legacy/messages_spec.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/functional/legacy/messages_spec.lua') diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index a604e68822..7536506aa3 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -6,6 +6,7 @@ local exec = helpers.exec local feed = helpers.feed local meths = helpers.meths local nvim_dir = helpers.nvim_dir +local assert_alive = helpers.assert_alive before_each(clear) @@ -758,4 +759,9 @@ describe('messages', function() ]]) os.remove('b.txt') end) + + it('no crash when truncating overlong message', function() + pcall(command, 'source test/old/testdir/crash/vim_msg_trunc_poc') + assert_alive() + end) end) -- cgit From 951034614110cf2e4388645ee17ed4a315d0d382 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 24 Nov 2023 06:13:24 +0800 Subject: vim-patch:9.0.2125: File info disappears when 'cmdheight' has decreased (#26180) Problem: File info disappears immediately when 'cmdheight' has just decreased due to switching tabpage and 'shortmess' doesn't contain 'o' or 'O'. Solution: Make sure msg_row isn't smaller than cmdline_row. fixes: vim/vim#13560 closes: vim/vim#13561 https://github.com/vim/vim/commit/40ed6711bd385051021691980e8ce16375b4b510 --- test/functional/legacy/messages_spec.lua | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'test/functional/legacy/messages_spec.lua') diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index 7536506aa3..e0cc1dc79c 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -727,6 +727,46 @@ describe('messages', function() ]]) end) + -- oldtest: Test_fileinfo_tabpage_cmdheight() + it("fileinfo works when 'cmdheight' has just decreased", function() + screen = Screen.new(40, 6) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}; -- NonText + [1] = {bold = true}; -- TabLineSel + [2] = {underline = true, background = Screen.colors.LightGrey}; -- TabLine + [3] = {reverse = true}; -- TabLineFill + }) + screen:attach() + + exec([[ + set shortmess-=o + set shortmess-=O + set shortmess-=F + tabnew + set cmdheight=2 + ]]) + command('mode') -- FIXME: bottom is invalid after scrolling + screen:expect([[ + {2: [No Name] }{1: [No Name] }{3: }{2:X}| + ^ | + {0:~ }| + {0:~ }| + | + | + ]]) + + feed(':tabprev | edit Xfileinfo.txt') + screen:expect([[ + {1: Xfileinfo.txt }{2: [No Name] }{3: }{2:X}| + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + "Xfileinfo.txt" [New] | + ]]) + assert_alive() + end) + -- oldtest: Test_fileinfo_after_echo() it('fileinfo does not overwrite echo message vim-patch:8.2.4156', function() screen = Screen.new(40, 6) @@ -734,6 +774,7 @@ describe('messages', function() [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText }) screen:attach() + exec([[ set shortmess-=F @@ -747,6 +788,7 @@ describe('messages', function() autocmd CursorHold * buf b.txt | w | echo "'b' written" ]]) + command('set updatetime=50') feed('0$') screen:expect([[ -- cgit