Add synchronized output support (DEC mode 2026)#5453
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 <[email protected]>
Tyriar
left a comment
There was a problem hiding this comment.
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.
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.
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 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
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 <[email protected]>
|
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 |
Tyriar
left a comment
There was a problem hiding this comment.
Tests should pass now, thanks @chrislloyd! I think for VS Code we've frozen builds for the holidays but I expect this to be in Insiders shortly after New Year's.
|
Almost, fixing 😅 |
|
@Tyriar amazing, thank you so much ❤️ !! |
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