aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/messages_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:39:54 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:39:54 +0000
commit21cb7d04c387e4198ca8098a884c78b56ffcf4c2 (patch)
tree84fe5690df1551f0bb2bdfe1a13aacd29ebc1de7 /test/functional/legacy/messages_spec.lua
parentd9c904f85a23a496df4eb6be42aa43f007b22d50 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-colorcolchar.tar.gz
rneovim-colorcolchar.tar.bz2
rneovim-colorcolchar.zip
Merge remote-tracking branch 'upstream/master' into colorcolcharcolorcolchar
Diffstat (limited to 'test/functional/legacy/messages_spec.lua')
-rw-r--r--test/functional/legacy/messages_spec.lua119
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)