aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/messages_spec.lua
diff options
context:
space:
mode:
authorJongwook Choi <wookayin@gmail.com>2023-10-12 19:27:45 -0400
committerGitHub <noreply@github.com>2023-10-13 07:27:45 +0800
commitebe489d8f0edbb3538a59733289d8969d1ffea22 (patch)
tree88dc7ce8eb96bab412f6ffdb739fb151903d4364 /test/functional/ui/messages_spec.lua
parent2c9f22e7e4947e1865ab18c61fbc0199be8b323d (diff)
downloadrneovim-ebe489d8f0edbb3538a59733289d8969d1ffea22.tar.gz
rneovim-ebe489d8f0edbb3538a59733289d8969d1ffea22.tar.bz2
rneovim-ebe489d8f0edbb3538a59733289d8969d1ffea22.zip
fix: allow multiline message for echoerr (#25380)
PROBLEM: Currently `:echoerr` prints multi-line strings in a single line as `:echom` does (Note: `:echon` can print multi-line strings well). This makes stacktrace printed via echoerr difficult to read. Example code: try lua error("lua stacktrace") catch echoerr v:exception endtry Output: Error detected while processing a.vim[5]..a.vim: line 4: Vim(lua):E5108: Error executing lua [string ":lua"]:1: lua stacktrace^@stack traceback:^@^I[C]: in function 'error'^@^I[string ":lua"]:1: in main chunk SOLUTION: Allow echoerr to print multiline messages (e.g., lua exceptions), because this command is usually used to print stacktraces. Output after the fix: Error detected while processing a.vim[5]..a.vim: line 4: Vim(lua):E5108: Error executing lua [string ":lua"]:1: lua stacktrace stack traceback: [C]: in function 'error' [string ":lua"]:1: in main chunk
Diffstat (limited to 'test/functional/ui/messages_spec.lua')
-rw-r--r--test/functional/ui/messages_spec.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 8a13796c04..ca2bf67220 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -333,6 +333,36 @@ describe('ui/ext_messages', function()
]]}
end)
+ it(':echoerr multiline', function()
+ exec_lua([[vim.g.multi = table.concat({ "bork", "fail" }, "\n")]])
+ feed(':echoerr g:multi<cr>')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]], messages={{
+ content = {{ "bork\nfail", 2 }},
+ kind = "echoerr"
+ }}}
+
+ 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 = {{ "bork\nfail", 2 }},
+ kind = "echoerr"
+ }}}
+ end)
+
it('shortmess-=S', function()
command('set shortmess-=S')
feed('iline 1\nline 2<esc>')