From 9a29622b545fc76c8b44d0e2b90f318a599eef39 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 1 Sep 2026 11:17:22 -0400 Subject: feat(multicursor): MC HAMMER #41587 Other (squashed) commits: fix(tui): emit ui_send output atomically with the frame Problem: tui_ui_send() writes directly to the TTY, bypassing the output buffer. Sequences sent via nvim_ui_send() (e.g. kitty multiple-cursors, or visual-dot-repeat) always arrive in a separate TTY write from the frame they were computed for. This manifests as "tearing", or e.g. in the case of multicursor the terminal renders text with stale cursor overlays. Solution: - tui_ui_send(): while a frame is being assembled (pending invalid regions or buffered output), buffer instead of writing directly. - Out-of-frame sends (tty queries, clear-on-disable) still write immediately. - mcursor.lua: emit the terminal-cursor update at the end of the redraw cycle (`on_end`, when screen positions are final) instead of vim.schedule(). --- runtime/lua/vim/hl.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/hl.lua') diff --git a/runtime/lua/vim/hl.lua b/runtime/lua/vim/hl.lua index f6df80deed..1a73a3e4a8 100644 --- a/runtime/lua/vim/hl.lua +++ b/runtime/lua/vim/hl.lua @@ -198,7 +198,9 @@ function M.hl_op(opts) local winid = api.nvim_get_current_win() local state = hl_op_state[state_key] - if state ~= nil and state.timer and not state.timer:is_closing() then + -- Multicursor cascade: accumulate per-cursor, don't cancel the previous event's highlight. + local cascading = api.nvim__mcursor_cascading() + if state ~= nil and state.timer and not state.timer:is_closing() and not cascading then state.timer:close() assert(state.clear) state.clear() -- cgit