From 1d57374c41e6c46c41d537c342ce30ad96cdb85b Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 27 Jan 2026 15:30:37 +0100 Subject: fix(ui): textlock still causes issues for UI callbacks #37513 Problem: There are still ways to run into textlock errors with vim.ui_attach callbacks trying to display a UI event. Solution: Disregard textlock again during vim.ui_attach() callbacks (also when scheduled). Partially revert 3277dc3b; avoiding to flush while textlock is set is still helpful. --- src/nvim/lua/executor.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/lua/executor.c') diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index e047c051f7..78d4515057 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -382,10 +382,18 @@ static void nlua_schedule_event(void **argv) lua_State *const lstate = global_lstate; nlua_pushref(lstate, cb); nlua_unref_global(lstate, cb); + + // Don't impose textlock restrictions upon UI event handlers. + int save_expr_map_lock = expr_map_lock; + int save_textlock = textlock; + expr_map_lock = ns_id > 0 ? 0 : expr_map_lock; + textlock = ns_id > 0 ? 0 : textlock; if (nlua_pcall(lstate, 0, 0)) { nlua_error(lstate, _("vim.schedule callback: %.*s")); ui_remove_cb(ns_id, true); } + expr_map_lock = save_expr_map_lock; + textlock = save_textlock; } /// Schedule Lua callback on main loop's event queue -- cgit