diff options
| author | Sébastien Hoffmann <contact@shoffmann.dev> | 2026-07-11 16:38:12 +0200 |
|---|---|---|
| committer | Sébastien Hoffmann <contact@shoffmann.dev> | 2026-07-11 18:44:42 +0200 |
| commit | 0ffd74ae85bf9c6c41c904775ec6ec6d8a3eebb6 (patch) | |
| tree | 727122f1dad6a203a817f2f8bb35720915f63285 /runtime/lua/vim | |
| parent | 2473cb62b7f4d77e2691d5040e06a2a61ab34462 (diff) | |
| download | rneovim-0ffd74ae85bf9c6c41c904775ec6ec6d8a3eebb6.tar.gz rneovim-0ffd74ae85bf9c6c41c904775ec6ec6d8a3eebb6.tar.bz2 rneovim-0ffd74ae85bf9c6c41c904775ec6ec6d8a3eebb6.zip | |
fix(ui2): fix ruler on repeated messages
Problem: a long message is cropped to keep the ruler visible. But when
the message is repeated, it can be written over the ruler, while the
repetition indicator "(1)" is still placed just before the ruler, which
ends up somewhere inside the message.
Solution: currently, long messages are only cropped when setting the
'last' virttext. Make sure this happens after a repeated long message.
Diffstat (limited to 'runtime/lua/vim')
| -rw-r--r-- | runtime/lua/vim/_core/ui2/messages.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/lua/vim/_core/ui2/messages.lua b/runtime/lua/vim/_core/ui2/messages.lua index 4182fd573b..7a6bd6e4c0 100644 --- a/runtime/lua/vim/_core/ui2/messages.lua +++ b/runtime/lua/vim/_core/ui2/messages.lua @@ -390,6 +390,13 @@ function M.show_msg(tgt, kind, content, replace_last, append, id) M.virt[tgt][M.virt.idx.dupe][1] = dupe > 0 and { 0, ('(%d)'):format(dupe) } or nil M.virt[tgt][M.virt.idx.spill][1] = tgt == 'cmd' and M.virt.cmd[M.virt.idx.spill][1] or nil set_virttext(tgt --[[@as 'cmd'|'msg']], tgt) + if tgt == 'cmd' then + -- make sure repeated long messages are cropped to keep the ruler intact + -- (if this is not scheduled, it breaks messages during textlock) + vim.schedule(function() + set_virttext('last', 'cmd') + end) + end end -- Reset message state the next event loop iteration. |