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().
This commit is contained in:
Justin M. Keyes
2026-09-01 11:17:22 -04:00
committed by GitHub
parent 9ebf9b1017
commit 9a29622b54
63 changed files with 5093 additions and 347 deletions

View File

@@ -2883,6 +2883,15 @@ describe('API', function()
eq({ 'a', 'b', 'c' }, eval('[g:one, g:Two, g:THREE]'))
api.nvim_load_context(ctx)
eq({ 1, 2, 3 }, eval('[g:one, g:Two, g:THREE]'))
-- Context restores what it saved, irrespective of 'shada'.
command('set shada=')
command('autocmd OptionSet shada let g:optionset = 1')
api.nvim_set_var('one', 'a')
api.nvim_load_context(ctx)
eq(1, eval('g:one'))
eq('', eval('&shada'))
eq(0, eval("get(g:, 'optionset', 0)"))
end)
it('errors when context dict is invalid', function()