Skip to content

Conversation

@chrislloyd
Copy link

Summary

Implements synchronized output mode (DEC private mode 2026) as specified in the VT extension.

  • BSU (CSI ? 2026 h) - Begin Synchronized Update: pauses rendering
  • ESU (CSI ? 2026 l) - End Synchronized Update: flushes buffer atomically

This allows applications to batch terminal updates and render them atomically, preventing screen tearing during rapid output.

Features

  • Rendering is paused when mode 2026 is enabled
  • Row updates are tracked and rendered atomically when mode is disabled
  • Configurable safety timeout via synchronizedOutputTimeout option (default: 5000ms)
  • Mode exposed via terminal.modes.synchronizedOutputMode

New Option

const term = new Terminal({
  synchronizedOutputTimeout: 5000  // default, set to 0 to disable timeout
});

Test Plan

  • Unit tests for RenderService synchronized output (10 new test cases)
  • Manual testing with escape sequences in demo
  • All 2305 existing tests pass

Manual Testing

# Lines appear atomically after delay
printf '\e[?2026h'; for i in 1 2 3 4 5; do echo "Line $i"; sleep 0.3; done; printf '\e[?2026l'

# Timeout test - auto-flushes after 5 seconds
printf '\e[?2026h'; echo "Waiting for timeout..."

Closes #3375

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Synchronized Output

1 participant