mirror of
https://github.com/neovim/neovim.git
synced 2025-09-11 22:08:18 +00:00
fix(messages)!: vim.ui_attach message callbacks are unsafe
Problem: Lua callbacks for "msg_show" events with vim.ui_attach() are executed when it is not safe. Solution: Disallow non-fast API calls for "msg_show" event callbacks. Automatically detach callback after excessive errors. Make sure fast APIs do not modify Nvim state.
This commit is contained in:
@@ -1083,6 +1083,10 @@ vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()*
|
||||
|ui-popupmenu| and the sections below for event format for respective
|
||||
events.
|
||||
|
||||
Callbacks for `msg_show` events are executed in |api-fast| context.
|
||||
|
||||
Excessive errors inside the callback will result in forced detachment.
|
||||
|
||||
WARNING: This api is considered experimental. Usability will vary for
|
||||
different screen elements. In particular `ext_messages` behavior is
|
||||
subject to further changes and usability improvements. This is expected to
|
||||
|
@@ -72,7 +72,8 @@ EDITOR
|
||||
|
||||
EVENTS
|
||||
|
||||
• TODO
|
||||
• |vim.ui_attach()| callbacks for |ui-messages| `msg_show` events are executed in
|
||||
|api-fast| context.
|
||||
|
||||
LSP
|
||||
|
||||
|
@@ -233,6 +233,10 @@ function vim.wait(time, callback, interval, fast_only) end
|
||||
--- {callback} receives event name plus additional parameters. See |ui-popupmenu|
|
||||
--- and the sections below for event format for respective events.
|
||||
---
|
||||
--- Callbacks for `msg_show` events are executed in |api-fast| context.
|
||||
---
|
||||
--- Excessive errors inside the callback will result in forced detachment.
|
||||
---
|
||||
--- WARNING: This api is considered experimental. Usability will vary for
|
||||
--- different screen elements. In particular `ext_messages` behavior is subject
|
||||
--- to further changes and usability improvements. This is expected to be
|
||||
|
Reference in New Issue
Block a user