diff options
author | luukvbaal <luukvbaal@gmail.com> | 2025-01-02 14:51:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-02 05:51:03 -0800 |
commit | 48e2a73610ca5639408f79b3d8eebd3e5f57a327 (patch) | |
tree | e84d5ab3decc765d7532c172d961fcd554d5b23a /runtime | |
parent | 9d9ee3476e6478850ce8822c85154f0c98570371 (diff) | |
download | rneovim-48e2a73610ca5639408f79b3d8eebd3e5f57a327.tar.gz rneovim-48e2a73610ca5639408f79b3d8eebd3e5f57a327.tar.bz2 rneovim-48e2a73610ca5639408f79b3d8eebd3e5f57a327.zip |
feat(ui)!: emit prompt "messages" as cmdline events #31525
Problem: Prompts are emitted as messages events, where cmdline events
are more appropriate. The user input is also emitted as
message events in fast context, so cannot be displayed with
vim.ui_attach().
Solution: Prompt for user input through cmdline prompts.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/lua.txt | 5 | ||||
-rw-r--r-- | runtime/doc/news.txt | 9 | ||||
-rw-r--r-- | runtime/doc/ui.txt | 2 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/builtin.lua | 5 |
4 files changed, 10 insertions, 11 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 25e58c0240..463389ed65 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1086,9 +1086,8 @@ 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 unless - Nvim will wait for input, in which case messages should be shown - immediately. + Callbacks for `msg_show` events are executed in |api-fast| context; + showing the message should be scheduled. Excessive errors inside the callback will result in forced detachment. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 9ab0a01b99..8a8ef00aa7 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -92,12 +92,15 @@ EVENTS • |vim.ui_attach()| callbacks for |ui-messages| `msg_show` events are executed in |api-fast| context. • New/enhanced arguments in these existing UI events: - • `cmdline_show`: `hl_id` argument to highlight the prompt text. • `cmdline_hide`: `abort` argument indicating if the cmdline was aborted. + • `cmdline_show`: + • Prompts that were previously emitted as `msg_show` events, are now routed + through `cmdline_show`. + • `hl_id` argument to highlight the prompt text. • `msg_show`: • `history` argument indicating if the message was added to the history. - • new message kinds: "bufwrite", "completion", "list_cmd", - "lua_print", "number_prompt", "search_cmd", "undo", "wildlist". + • new message kinds: "bufwrite", "completion", "list_cmd", "lua_print", + "search_cmd", "undo", "wildlist". HIGHLIGHTS diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index 1b11565eeb..8f25133e7a 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -792,7 +792,6 @@ must handle. "" (empty) Unknown (consider a |feature-request|) "bufwrite" |:write| message "confirm" |confirm()| or |:confirm| dialog - "confirm_sub" |:substitute| confirm dialog |:s_c| "emsg" Error (|errors|, internal error, |:throw|, …) "echo" |:echo| message "echomsg" |:echomsg| message @@ -802,7 +801,6 @@ must handle. "lua_error" Error in |:lua| code "lua_print" |print()| from |:lua| code "rpc_error" Error response from |rpcrequest()| - "number_prompt" Number input prompt (|inputlist()|, |z=|, …) "return_prompt" |press-enter| prompt after a multiple messages "quickfix" Quickfix navigation message "search_cmd" Entered search command diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua index b8779b66fe..9fa2e242c4 100644 --- a/runtime/lua/vim/_meta/builtin.lua +++ b/runtime/lua/vim/_meta/builtin.lua @@ -233,9 +233,8 @@ 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 unless ---- Nvim will wait for input, in which case messages should be shown ---- immediately. +--- Callbacks for `msg_show` events are executed in |api-fast| context; showing +--- the message should be scheduled. --- --- Excessive errors inside the callback will result in forced detachment. --- |