neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 3277dc3b4ee7c260fb56467aa86504b9f0b7772e
parent 4e2ed1d03c08387fa2489227798844e85e9868c5
Author: luukvbaal <luukvbaal@gmail.com>
Date:   Tue,  2 Dec 2025 16:51:22 +0100

fix(ui): postpone UI callbacks during textlock #36803

Problem:  UI callbacks disregard textlock unnecessarily (since d909de2).

Solution: In case the UI is flushed during textlock, make sure Nvim does
          not flush UI callbacks that are expected to change text. Instead
          assume postponing callbacks during textlock is insignificant,
          and will safely happen soon after.
Diffstat:
Msrc/nvim/ui.c | 13+++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/nvim/ui.c b/src/nvim/ui.c @@ -538,8 +538,6 @@ void ui_flush(void) static bool was_busy = false; - cmdline_ui_flush(); - if (!(State & MODE_CMDLINE) && curwin->w_floating && curwin->w_config.hide) { if (!was_busy) { ui_call_busy_start(); @@ -551,7 +549,11 @@ void ui_flush(void) } win_ui_flush(false); - msg_ext_ui_flush(); + // Avoid flushing callbacks expected to change text during textlock. + if (textlock == 0) { + cmdline_ui_flush(); + msg_ext_ui_flush(); + } msg_scroll_flush(); if (pending_cursor_update) { @@ -744,10 +746,6 @@ void ui_call_event(char *name, bool fast, Array args) bool handled = false; UIEventCallback *event_cb; - // UI callbacks need to be allowed to change text. - int save_textlock = textlock; - textlock = 0; - map_foreach(&ui_event_cbs, ui_event_ns_id, event_cb, { Error err = ERROR_INIT; uint32_t ns_id = ui_event_ns_id; @@ -762,7 +760,6 @@ void ui_call_event(char *name, bool fast, Array args) } api_clear_error(&err); }) - textlock = save_textlock; if (!handled) { UI_CALL(true, event, ui, name, args);