From c651fb30427a3c645b4b1bd8a9b7e767af51e014 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Fri, 8 Dec 2023 18:44:16 -0800 Subject: refactor(tui): use synchronized updates around actual buf flush (#26478) Rather than writing the synchronized update begin and end sequences into the TUI's internal buffer (where it is later flushed to the TTY), write these sequences directly to the TTY before and after the TUI's internal buffer is itself flushed to the TTY. This guarantees that a synchronized update is always used when we are actually sending data to the TTY. This means we do not need to keep track of the TUI's "dirty" state (any sequences which affect the TUI state will be written in the TUI's internal buffer, which is now guaranteed to only ever be written when a synchronized update is active). --- test/functional/terminal/tui_spec.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 4d2f20d6d5..9978bcca9d 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -1671,10 +1671,9 @@ describe('TUI', function() -- Use full screen message so that redrawing afterwards is more deterministic. child_session:notify('nvim_command', 'intro') screen:expect({any = 'Nvim'}) - -- Hiding the cursor needs 6 bytes. -- Going to top-left corner needs 3 bytes. -- Setting underline attribute needs 9 bytes. - -- The whole line needs 6 + 3 + 9 + 65513 + 3 = 65534 bytes. + -- The whole line needs 3 + 9 + 65513 + 3 = 65528 bytes. -- The cursor_address that comes after will overflow the 65535-byte buffer. local line = ('a'):rep(65513) .. '℃' child_session:notify('nvim_exec_lua', [[ -- cgit