Skip to content

perf: optimize xterm.js rendering for Linux#1

Merged
johannesjo merged 1 commit into
mainfrom
claude/optimize-xterm-linux-XMUaE
Feb 19, 2026
Merged

perf: optimize xterm.js rendering for Linux#1
johannesjo merged 1 commit into
mainfrom
claude/optimize-xterm-linux-XMUaE

Conversation

@johannesjo
Copy link
Copy Markdown
Owner

  • Remove blanket CSS transparency on all xterm layers — this was
    forcing alpha blending every frame and defeating the WebGL
    renderer's opaque fast path. The terminal theme already provides
    matching background colors per preset.
  • Disable font ligatures (font-variant-ligatures: none) and use
    text-rendering: optimizeSpeed — ligature shaping in JetBrains Mono
    and Fira Code is expensive on Linux font stacks.
  • Add CSS contain: strict to the terminal container for layout
    isolation (skips layout/paint work outside the terminal).
  • Switch shell terminal dimming from CSS opacity + transition to
    filter: opacity() with will-change hint — avoids triggering a full
    compositor layer blend on every repaint.

https://claude.ai/code/session_01FtXB5R8qjM54WqwE1FLCYJ

- Remove blanket CSS transparency on all xterm layers — this was
  forcing alpha blending every frame and defeating the WebGL
  renderer's opaque fast path. The terminal theme already provides
  matching background colors per preset.
- Disable font ligatures (font-variant-ligatures: none) and use
  text-rendering: optimizeSpeed — ligature shaping in JetBrains Mono
  and Fira Code is expensive on Linux font stacks.
- Add CSS contain: strict to the terminal container for layout
  isolation (skips layout/paint work outside the terminal).
- Switch shell terminal dimming from CSS opacity + transition to
  filter: opacity() with will-change hint — avoids triggering a full
  compositor layer blend on every repaint.

https://claude.ai/code/session_01FtXB5R8qjM54WqwE1FLCYJ
@johannesjo johannesjo merged commit e2b50db into main Feb 19, 2026
1 check passed
@johannesjo johannesjo deleted the claude/optimize-xterm-linux-XMUaE branch February 19, 2026 23:50
johannesjo pushed a commit that referenced this pull request May 15, 2026
…ck initial prompts (#107)

* fix(prompt): scale bracketed-paste delay by line count to prevent stuck initial prompts

When an agent enables bracketed paste mode (CSI ? 2004 h), synthetic prompt
sends wrap the text in \x1b[200~...\x1b[201~ to avoid Codex's paste-burst
guard. However, TUI agents like Claude Code process the paste asynchronously —
if \r arrives while the paste is still being consumed, it is absorbed into the
input buffer as a newline rather than submitting the prompt.

The previous fixed 50ms delay was sufficient for short prompts but too short
for large ones (e.g. a 31-line initial task prompt). The symptom is the agent
sitting in INSERT mode with "[Pasted text #1 +N lines]" in its input, never
sending.

Fix:
- Track bracketed paste mode (CSI ? 2004 h/l) in AgentTrackingState via
  updateBracketedPasteMode(), called on each PTY data chunk in markAgentOutput()
- Export isAgentBracketedPasteEnabled() so sendPrompt can conditionally wrap
- Scale the pre-Enter delay: max(50ms, lines * 15ms), capped at 500ms —
  a 31-line prompt now waits ~465ms instead of 50ms

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(prompt): add pasteDelayMs regression tests; export fn; fix duplicate constants

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <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.

2 participants