mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #20984 from notomo/fix-message-kind-on-history
fix(ui-ext): correct message kind in history before vim.ui_attach()
This commit is contained in:
commit
c4f84fc2e2
@ -3153,6 +3153,7 @@ int msg_end(void)
|
|||||||
void msg_ext_ui_flush(void)
|
void msg_ext_ui_flush(void)
|
||||||
{
|
{
|
||||||
if (!ui_has(kUIMessages)) {
|
if (!ui_has(kUIMessages)) {
|
||||||
|
msg_ext_kind = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,4 +117,31 @@ describe('vim.ui_attach', function()
|
|||||||
})
|
})
|
||||||
eq(0, helpers.eval('v:shell_error'))
|
eq(0, helpers.eval('v:shell_error'))
|
||||||
end)
|
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)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user