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.
This commit is contained in:
phanium
2026-02-13 00:10:37 +08:00
committed by GitHub
parent e8ace82093
commit 179e7fccd7
3 changed files with 35 additions and 2 deletions

View File

@@ -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'

View File

@@ -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.

View File

@@ -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()