neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 179e7fccd74b02da06664de7103ba4ccee40778d
parent e8ace820934a9eb7f23b7a3f61ccea2c7de02043
Author: phanium <91544758+phanen@users.noreply.github.com>
Date:   Fri, 13 Feb 2026 00:10:37 +0800

fix(ui2): incomplete :echon message in g< pager #37819

Problem:
`:echo 1 | echon 2<cr>g<` shows "2", but should be "12".

Solution:
Don't clear temp msg (g<) if we are appending.
Diffstat:
Mruntime/lua/vim/_core/ui2/messages.lua | 4+++-
Msrc/nvim/message.c | 2+-
Mtest/functional/ui/messages2_spec.lua | 31+++++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 2 deletions(-)

diff --git 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 @@ -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 @@ -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<lt>') + screen:expect([[ + | + {1:~ }|*10 + {3: }| + ^12 | + | + ]]) + feed([[q:echo 1 | echon 2 | echon 2 | echon 3<CR>]]) + screen:expect([[ + ^ | + {1:~ }|*12 + 1223 | + ]]) + feed('g<lt>') + screen:expect([[ + | + {1:~ }|*10 + {3: }| + ^1223 | + | + ]]) + end) + it('shows message from still running command', function() exec_lua(function() vim.schedule(function()