mirror of
https://github.com/neovim/neovim.git
synced 2026-08-30 02:51:48 +00:00
fix(ui): only internal messages are unsafe #37462
Problem: Fast context for msg_show event inhibits vim.ui_attach from
displaying a stream of messages from a single command.
Solution: Remove fast context from msg_show events emitted as a result
of explicit API/command calls. The fast context was originally
introduced to prevent issues with internal messages.
This commit is contained in:
@@ -429,7 +429,7 @@ describe('vim.ui_attach', function()
|
||||
exec_lua([[
|
||||
vim.ui_attach(vim.api.nvim_create_namespace(''), { ext_messages = true }, function(ev)
|
||||
if ev == 'msg_show' then
|
||||
vim.api.nvim_buf_set_lines(0, -2, -1, false, { err[1] })
|
||||
error('foo')
|
||||
end
|
||||
end)
|
||||
]])
|
||||
@@ -437,10 +437,13 @@ describe('vim.ui_attach', function()
|
||||
screen:expect({
|
||||
grid = [[
|
||||
|
|
||||
{1:~ }|*5
|
||||
{1:~ }|*2
|
||||
{3: }|
|
||||
{9:Error in "msg_show" UI event handler (ns=(UNKNOWN PLUGIN)):} |
|
||||
{9:fast context failure} |
|
||||
{9:Lua callback:} |
|
||||
{9:[string "<nvim>"]:3: foo} |
|
||||
{9:stack traceback:} |
|
||||
{9: [C]: in function 'error'} |
|
||||
{9: [string "<nvim>"]:3: in function <[string "<nvim>"]:1>} |
|
||||
{100:Press ENTER or type command to continue}^ |
|
||||
]],
|
||||
condition = function()
|
||||
@@ -448,17 +451,12 @@ describe('vim.ui_attach', function()
|
||||
end,
|
||||
})
|
||||
feed('<Esc>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*8
|
||||
|
|
||||
]])
|
||||
|
||||
-- Also when scheduled
|
||||
exec_lua([[
|
||||
vim.ui_attach(vim.api.nvim_create_namespace(''), { ext_messages = true }, function(ev)
|
||||
if ev == 'msg_show' then
|
||||
vim.schedule(function() vim.api.nvim_buf_set_lines(0, -2, -1, false, { err[1] }) end)
|
||||
vim.schedule(function() error('foo') end)
|
||||
end
|
||||
end)
|
||||
]])
|
||||
|
||||
Reference in New Issue
Block a user