feat: support synchronized output (DEC private mode 2026) - #237
Open
smohekey wants to merge 1 commit into
Open
Conversation
Applications that redraw a full frame (e.g. ratatui-based TUIs such as the Codex CLI) bracket each atomic update in `ESC[?2026h` … `ESC[?2026l` to tell the terminal "don't paint until I'm done". xterm.dart ignored the mode and painted every intermediate write, which shows as flicker during redraws. Honour mode 2026: suspend `notifyListeners()` between begin and end, then flush a single repaint on end so the completed frame appears atomically. A 150ms safety timeout force-ends the update if the matching `?2026l` is lost (e.g. across a reconnect) so the display can never stay frozen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Honour DEC private mode 2026 (synchronized output). Applications that redraw a full frame bracket each atomic update in
ESC[?2026h…ESC[?2026lto tell the terminal "don't paint until I'm done." xterm.dart ignored the mode and painted every intermediate write, which shows as flicker during redraws — notably with ratatui-based TUIs such as the Codex CLI, which brackets every frame this way.How
Suspend
notifyListeners()between begin and end, then flush a single repaint on end so the completed frame appears atomically. A 150 ms safety timeout force-ends the update if the matching?2026lis lost (e.g. across a reconnect), so the display can never stay frozen.Reproduce
Test
Adds
test/src/synchronized_output_test.dartcovering repaint suppression between begin/end, the flush on end, and that normal writes still repaint when no update is held.