fix(messages): no message kind for :undo messages #31590

Problem: cannot handle `:undo` and `:redo` messages in a special way,
e.g. replace one by another.

Solution: add `undo` kind.
This commit is contained in:
Tomasz N 2024-12-16 12:07:27 +01:00 committed by GitHub
parent 01a97d2ad7
commit 9c6a3703bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 0 deletions

View File

@ -805,6 +805,7 @@ must handle.
"quickfix" Quickfix navigation message
"search_cmd" Entered search command
"search_count" Search count message ("S" flag of 'shortmess')
"undo" |:undo| and |:redo| message
"wildlist" 'wildmode' "list" message
"wmsg" Warning ("search hit BOTTOM", |W10|, …)
New kinds may be added in the future; clients should treat unknown

View File

@ -1862,6 +1862,7 @@ static void u_doit(int startcount, bool quiet, bool do_buf_event)
u_oldcount = -1;
}
msg_ext_set_kind("undo");
int count = startcount;
while (count--) {
// Do the change warning now, so that it triggers FileChangedRO when

View File

@ -240,6 +240,36 @@ describe('ui/ext_messages', function()
},
},
})
-- undo
feed('uu')
screen:expect({
grid = [[
^ |
{1:~ }|*4
]],
messages = {
{
content = { { 'Already at oldest change' } },
kind = 'undo',
},
},
})
feed('<C-r><C-r><C-r>')
screen:expect({
grid = [[
line 1 |
line^ |
{1:~ }|*3
]],
messages = {
{
content = { { 'Already at newest change' } },
kind = 'undo',
},
},
})
end)
it(':echoerr', function()