api(echo): should clear cmdline before echo

This commit is contained in:
notomo
2021-01-21 21:49:25 +09:00
parent d68026c9ed
commit d3989ea8e8
2 changed files with 16 additions and 1 deletions

View File

@@ -1011,8 +1011,9 @@ void nvim_echo(Array chunks, Boolean history, Dictionary opts, Error *err)
} }
no_wait_return++; no_wait_return++;
bool need_clear = true;
msg_start(); msg_start();
msg_clr_eos();
bool need_clear = false;
for (uint32_t i = 0; i < kv_size(hl_msg); i++) { for (uint32_t i = 0; i < kv_size(hl_msg); i++) {
HlMessageChunk chunk = kv_A(hl_msg, i); HlMessageChunk chunk = kv_A(hl_msg, i);
msg_multiline_attr((const char *)chunk.text.data, chunk.attr, msg_multiline_attr((const char *)chunk.text.data, chunk.attr,

View File

@@ -2021,6 +2021,20 @@ describe('API', function()
command('highlight Special guifg=SlateBlue') command('highlight Special guifg=SlateBlue')
end) end)
it('should clear cmdline message before echo', function()
feed(':call nvim_echo([["msg"]], v:false, {})<CR>')
screen:expect{grid=[[
^ |
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
{0:~ }|
msg |
]]}
end)
it('can show highlighted line', function() it('can show highlighted line', function()
nvim_async("echo", {{"msg_a"}, {"msg_b", "Statement"}, {"msg_c", "Special"}}, true, {}) nvim_async("echo", {{"msg_a"}, {"msg_b", "Statement"}, {"msg_c", "Special"}}, true, {})
screen:expect{grid=[[ screen:expect{grid=[[