diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
commit | 1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch) | |
tree | cd08258054db80bb9a11b1061bb091c70b76926a /test/functional/legacy/messages_spec.lua | |
parent | eaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-aucmd_textputpost.tar.gz rneovim-aucmd_textputpost.tar.bz2 rneovim-aucmd_textputpost.zip |
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'test/functional/legacy/messages_spec.lua')
-rw-r--r-- | test/functional/legacy/messages_spec.lua | 119 |
1 files changed, 116 insertions, 3 deletions
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index 71a53c8381..e0cc1dc79c 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) @@ -49,6 +50,71 @@ 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 + [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg + }) + screen:attach() + exec([[ + nmap <silent> gx :call DebugSilent('normal')<CR> + vmap <silent> gx :call DebugSilent('visual')<CR> + function DebugSilent(arg) + echomsg "from DebugSilent" a:arg + endfunction + set showmode + set cmdheight=1 + call setline(1, ['one', 'NoSuchFile', 'three']) + ]]) + + feed('gx') + screen:expect([[ + ^one | + NoSuchFile | + 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 | + NoSuchFile | + three | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {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() before_each(function() command('set more') @@ -361,9 +427,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')<CR>]]) @@ -661,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<CR>') + 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) @@ -668,6 +774,7 @@ describe('messages', function() [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText }) screen:attach() + exec([[ set shortmess-=F @@ -681,6 +788,7 @@ describe('messages', function() autocmd CursorHold * buf b.txt | w | echo "'b' written" ]]) + command('set updatetime=50') feed('0$') screen:expect([[ @@ -693,4 +801,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) |