mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(ui-ext): correct message kind in history before vim.ui_attach()
This commit is contained in:
parent
8045296e8b
commit
72f8613e97
@ -3151,6 +3151,7 @@ int msg_end(void)
|
||||
void msg_ext_ui_flush(void)
|
||||
{
|
||||
if (!ui_has(kUIMessages)) {
|
||||
msg_ext_kind = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,4 +117,31 @@ describe('vim.ui_attach', function()
|
||||
})
|
||||
eq(0, helpers.eval('v:shell_error'))
|
||||
end)
|
||||
|
||||
it('can receive accurate message kinds even if they are history', function()
|
||||
exec_lua([[
|
||||
vim.cmd.echomsg("'message1'")
|
||||
print('message2')
|
||||
vim.ui_attach(ns, { ext_messages = true }, on_event)
|
||||
vim.cmd.echomsg("'message3'")
|
||||
]])
|
||||
feed(':messages<cr>')
|
||||
feed('<cr>')
|
||||
|
||||
local actual = exec_lua([[
|
||||
return vim.tbl_filter(function (event)
|
||||
return event[1] == "msg_history_show"
|
||||
end, events)
|
||||
]])
|
||||
eq({
|
||||
{
|
||||
'msg_history_show',
|
||||
{
|
||||
{ 'echomsg', { { 0, 'message1' } } },
|
||||
{ '', { { 0, 'message2' } } },
|
||||
{ 'echomsg', { { 0, 'message3' } } },
|
||||
},
|
||||
},
|
||||
}, actual, inspect(actual))
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user