-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add synchronized output support (DEC mode 2026) #5453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Implement synchronized output mode (CSI ? 2026 h/l) which allows applications to batch terminal updates and render them atomically, preventing screen tearing during rapid output. Features: - BSU (CSI ? 2026 h) pauses rendering, buffering row updates - ESU (CSI ? 2026 l) flushes buffer and renders atomically - Configurable timeout via synchronizedOutputTimeout option (default 5s) - Exposed via terminal.modes.synchronizedOutputMode Closes xtermjs#3375 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Tyriar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are you confirming the feature?
Bunch of CI failues
| // First request in this sync cycle | ||
| this._synchronizedOutputStart = start; | ||
| this._synchronizedOutputEnd = end; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very similar to DirtyRowTracker, pulling that out of InputHandler and using it would reduce some repetition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked into this - the shared logic is just the min/max row tracking (~4 lines). DirtyRowTracker has different reset semantics (resets to cursor position via IBufferService) and doesn't need timeout management. Felt like an abstraction would add complexity without much benefit, but happy to revisit if you feel strongly.
|
Thanks for the quick review!
Works in the example project - will record a video and put it up. |
- Remove synchronizedOutputTimeout public API, hardcode 1s timeout - Extract SynchronizedOutputHandler class for cleaner code - Update spec URL to contour-terminal/vt-extensions - Remove unnecessary comment in InputHandler - Delete unit tests, add integration tests in SharedRendererTests - Fix whitespace issue 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Applications can now detect synchronized output support by querying CSI ? 2026 $ p and receiving CSI ? 2026 ; <mode> $ y response. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Updated with videos in the description. |
|
Posix test script: clear;c=$(tput cols);r=$(tput lines);for f in $(seq 0 10 200); do printf '\e[?2026h\e[H';for y in $(seq 0 $((r-1)));do for x in $(seq 0 $((c-1)));do printf "\e[48;5;$((16+(x+y+f)%216))m ";done;echo;done;printf '\e[?2026l';sleep 0.03;done |
Summary
Implements synchronized output mode (DEC private mode 2026) as specified in the VT extension.
CSI ? 2026 h) - Begin Synchronized Update: defers renderingCSI ? 2026 l) - End Synchronized Update: flushes buffer atomicallyCSI ? 2026 $ p) - Query mode supportThis allows applications to batch terminal updates and render them atomically, preventing screen tearing during rapid output.
Features
Test Plan
Before:
Screen.Recording.2025-12-09.at.09.15.57.mov
After:
Screen.Recording.2025-12-09.at.09.16.45.mov
Manual Testing
Closes #3375
🤖 Generated with Claude Code