From 5bae80899d9d29d80c129ca92cde75a1583b5efe Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Tue, 14 Jan 2025 12:05:23 +0100 Subject: feat(messages): add :!cmd shell message kinds Also print stderr error messages with ErrorMsg highlight group. --- test/functional/ui/messages_spec.lua | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test/functional/ui/messages_spec.lua') diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index ea4edefe8a..4d53daa9d6 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -331,6 +331,7 @@ describe('ui/ext_messages', function() }, }) + -- kind=verbose for :verbose messages feed(':1verbose filter Diff[AC] hi') screen:expect({ cmdline = { { @@ -380,6 +381,43 @@ describe('ui/ext_messages', function() }, }, }) + + -- kind=shell for :!cmd messages + local cmd = t.is_os('win') and 'echo stdout& echo stderr>&2& exit 3' + or '{ echo stdout; echo stderr >&2; exit 3; }' + feed((':!%s'):format(cmd)) + screen:expect({ + cmdline = { { + abort = false, + } }, + messages = { + { + content = { { (':!%s\r\n[No write since last change]\n'):format(cmd) } }, + history = false, + kind = '', + }, + { + content = { { ('stdout%s\n'):format(t.is_os('win') and '\r' or '') } }, + history = false, + kind = 'shell_out', + }, + { + content = { { ('stderr%s\n'):format(t.is_os('win') and '\r' or ''), 9, 6 } }, + history = false, + kind = 'shell_err', + }, + { + content = { { '\nshell returned 3\n\n' } }, + history = false, + kind = 'shell_ret', + }, + { + content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, + kind = 'return_prompt', + }, + }, + }) end) it(':echoerr', function() -- cgit From d55b17e2b4e061fd8b330f928785a217c99c9d11 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Tue, 14 Jan 2025 17:23:11 +0100 Subject: fix(messages): verbose kind for nvim_echo() Problem: No "verbose" kind for nvim_echo() opts->verbose. Solution: Pass NULL "kind" to indicate no new kind. --- test/functional/ui/messages_spec.lua | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'test/functional/ui/messages_spec.lua') diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 4d53daa9d6..b70bd0e808 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -319,9 +319,7 @@ describe('ui/ext_messages', function() -- kind=echoerr for nvim_echo() err feed(':call nvim_echo([["Error"], ["Message", "Special"]], 1, #{ err:1 })') screen:expect({ - cmdline = { { - abort = false, - } }, + cmdline = { { abort = false } }, messages = { { content = { { 'Error', 9, 6 }, { 'Message', 16, 99 } }, @@ -331,12 +329,23 @@ describe('ui/ext_messages', function() }, }) + -- kind=verbose for nvim_echo() verbose + feed(':call nvim_echo([["Verbose Message"]], 1, #{ verbose:1 })') + screen:expect({ + cmdline = { { abort = false } }, + messages = { + { + content = { { 'Verbose Message' } }, + history = true, + kind = 'verbose', + }, + }, + }) + -- kind=verbose for :verbose messages feed(':1verbose filter Diff[AC] hi') screen:expect({ - cmdline = { { - abort = false, - } }, + cmdline = { { abort = false } }, messages = { { content = { @@ -387,9 +396,7 @@ describe('ui/ext_messages', function() or '{ echo stdout; echo stderr >&2; exit 3; }' feed((':!%s'):format(cmd)) screen:expect({ - cmdline = { { - abort = false, - } }, + cmdline = { { abort = false } }, messages = { { content = { { (':!%s\r\n[No write since last change]\n'):format(cmd) } }, @@ -1126,9 +1133,7 @@ describe('ui/ext_messages', function() ^ | {1:~ }|*4 ]], - cmdline = { { - abort = false, - } }, + cmdline = { { abort = false } }, }) eq(0, eval('&cmdheight')) end) -- cgit