diff options
author | luukvbaal <luukvbaal@gmail.com> | 2024-11-15 23:34:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-15 14:34:42 -0800 |
commit | 6e4df18b457e9743c34068fd6e0a89fd04d3526c (patch) | |
tree | 27b360b356b7bc779b06d28c7a0bd27d359c0c3b /src/nvim/ui.c | |
parent | f1748b78e3165a0821a11f5ae1fb9398aa67c535 (diff) | |
download | rneovim-6e4df18b457e9743c34068fd6e0a89fd04d3526c.tar.gz rneovim-6e4df18b457e9743c34068fd6e0a89fd04d3526c.tar.bz2 rneovim-6e4df18b457e9743c34068fd6e0a89fd04d3526c.zip |
fix(ui): no fast context for prompt message kinds #31224
Problem: No longer able to show prompt messages with vim.ui_attach().
Solution: Do not execute callback in fast context for prompt message
kinds. These events must be safe to show the incoming message
so the event itself serves to indicate that the message
should be shown immediately.
Diffstat (limited to 'src/nvim/ui.c')
-rw-r--r-- | src/nvim/ui.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/ui.c b/src/nvim/ui.c index d50747e63f..7c81110ae9 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -717,6 +717,13 @@ void ui_call_event(char *name, bool fast, Array args) { bool handled = false; UIEventCallback *event_cb; + + // Prompt messages should be shown immediately so must be safe + if (strcmp(name, "msg_show") == 0) { + char *kind = args.items[0].data.string.data; + fast = !kind || (strncmp(kind, "confirm", 7) != 0 && strcmp(kind, "return_prompt") != 0); + } + map_foreach(&ui_event_cbs, ui_event_ns_id, event_cb, { Error err = ERROR_INIT; uint32_t ns_id = ui_event_ns_id; |