aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/messages_spec.lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-06-10 11:23:17 +0200
committerbfredl <bjorn.linse@gmail.com>2022-06-11 22:29:51 +0200
commitf4121c52b95d4b79c0de95412c8447614a2f8960 (patch)
tree5f235062bb5f0d0729787ad263b292f40f51f355 /test/functional/ui/messages_spec.lua
parentc87a5ebbc31c56867f9d6f6d27bb8b7ddecc837e (diff)
downloadrneovim-f4121c52b95d4b79c0de95412c8447614a2f8960.tar.gz
rneovim-f4121c52b95d4b79c0de95412c8447614a2f8960.tar.bz2
rneovim-f4121c52b95d4b79c0de95412c8447614a2f8960.zip
fix(messages): add color when showing nvim_echo in :messages history
Diffstat (limited to 'test/functional/ui/messages_spec.lua')
-rw-r--r--test/functional/ui/messages_spec.lua106
1 files changed, 94 insertions, 12 deletions
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index ee49ae7a09..a6cf96c87e 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -31,6 +31,7 @@ describe('ui/ext_messages', function()
[7] = {background = Screen.colors.Yellow},
[8] = {foreground = Screen.colors.Red},
[9] = {special = Screen.colors.Red, undercurl = true},
+ [10] = {foreground = Screen.colors.Brown};
})
end)
after_each(function()
@@ -858,9 +859,53 @@ stack traceback:
{1:~ }|
{1:~ }|
]]}
-
end)
+ it('supports nvim_echo messages with multiple attrs', function()
+ async_meths.echo({{'wow, ',"Search"}, {"such\n\nvery ", "ErrorMsg"}, {"color", "LineNr"}}, true, {})
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], messages={
+ { content = { { "wow, ", 7 }, { "such\n\nvery ", 2 }, { "color", 10 } }, kind = "" }
+ }}
+
+ feed ':ls<cr>'
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], messages={
+ { content = { { '\n 1 %a "[No Name]" line 1' } }, kind = "echomsg" }
+ }}
+
+ feed ':messages<cr>'
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], messages={
+ { content = { { "Press ENTER or type command to continue", 4 } }, kind = "return_prompt" }
+ }, msg_history={
+ { content = { { "wow, ", 7 }, { "such\n\nvery ", 2 }, { "color", 10 } }, kind = "echomsg" }
+ }}
+
+ feed '<cr>'
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ end)
end)
describe('ui/builtin messages', function()
@@ -869,17 +914,19 @@ describe('ui/builtin messages', function()
clear()
screen = Screen.new(60, 7)
screen:attach({rgb=true, ext_popupmenu=true})
- screen:set_default_attr_ids({
- [1] = {bold = true, foreground = Screen.colors.Blue1},
- [2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
- [3] = {bold = true, reverse = true},
- [4] = {bold = true, foreground = Screen.colors.SeaGreen4},
- [5] = {foreground = Screen.colors.Blue1},
- [6] = {bold = true, foreground = Screen.colors.Magenta},
- [7] = {background = Screen.colors.Grey20},
- [8] = {reverse = true},
- [9] = {background = Screen.colors.LightRed}
- })
+ screen:set_default_attr_ids {
+ [1] = {bold = true, foreground = Screen.colors.Blue1};
+ [2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red};
+ [3] = {bold = true, reverse = true};
+ [4] = {bold = true, foreground = Screen.colors.SeaGreen4};
+ [5] = {foreground = Screen.colors.Blue1};
+ [6] = {bold = true, foreground = Screen.colors.Magenta};
+ [7] = {background = Screen.colors.Grey20};
+ [8] = {reverse = true};
+ [9] = {background = Screen.colors.LightRed};
+ [10] = {background = Screen.colors.Yellow};
+ [11] = {foreground = Screen.colors.Brown};
+ }
end)
it('supports multiline messages from rpc', function()
@@ -1115,6 +1162,41 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim
{4:Press ENTER or type command to continue}^ |
]]}
end)
+
+ it('supports nvim_echo messages with multiple attrs', function()
+ async_meths.echo({{'wow, ',"Search"}, {"such\n\nvery ", "ErrorMsg"}, {"color", "LineNr"}}, true, {})
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {3: }|
+ {10:wow, }{2:such} |
+ |
+ {2:very }{11:color} |
+ {4:Press ENTER or type command to continue}^ |
+ ]]}
+
+ feed '<cr>'
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+
+ feed ':messages<cr>'
+ screen:expect{grid=[[
+ |
+ {1:~ }|
+ {3: }|
+ {10:wow, }{2:such} |
+ |
+ {2:very }{11:color} |
+ {4:Press ENTER or type command to continue}^ |
+ ]]}
+ end)
end)
describe('ui/ext_messages', function()