diff --git a/runtime/lua/vim/_core/ui2/messages.lua b/runtime/lua/vim/_core/ui2/messages.lua index fb4b6a766b..29805b817b 100644 --- a/runtime/lua/vim/_core/ui2/messages.lua +++ b/runtime/lua/vim/_core/ui2/messages.lua @@ -255,7 +255,9 @@ function M.show_msg(tar, content, replace_last, append, id) for _, chunk in ipairs(content) do msg = msg .. chunk[2] end - dupe = (not extid and msg == M.prev_msg and ui.cmd.srow == 0 and M.dupe + 1 or 0) + dupe = ( + not extid and not append and msg == M.prev_msg and ui.cmd.srow == 0 and M.dupe + 1 or 0 + ) end cr = next(M[tar].ids) ~= nil and msg:sub(1, 1) == '\r' diff --git a/src/nvim/message.c b/src/nvim/message.c index 47fe520734..56fac98bff 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2739,7 +2739,7 @@ static void store_sb_text(const char **sb_str, const char *s, int hl_id, int *sb void may_clear_sb_text(void) { do_clear_sb_text = SB_CLEAR_ALL; - do_clear_hist_temp = true; + do_clear_hist_temp = !msg_ext_append; } /// Starting to edit the command line: do not clear messages now. diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua index 9648741f12..96eb1dbd27 100644 --- a/test/functional/ui/messages2_spec.lua +++ b/test/functional/ui/messages2_spec.lua @@ -441,6 +441,37 @@ describe('messages2', function() ]]) end) + it(':echon appends message', function() + command([[echo 1 | echon 2]]) + screen:expect([[ + ^ | + {1:~ }|*12 + 12 | + ]]) + feed('g') + screen:expect([[ + | + {1:~ }|*10 + {3: }| + ^12 | + | + ]]) + feed([[q:echo 1 | echon 2 | echon 2 | echon 3]]) + screen:expect([[ + ^ | + {1:~ }|*12 + 1223 | + ]]) + feed('g') + screen:expect([[ + | + {1:~ }|*10 + {3: }| + ^1223 | + | + ]]) + end) + it('shows message from still running command', function() exec_lua(function() vim.schedule(function()