Skip to content

fix(terminal): upgrade xterm.js to 6.0 to fix scroll jumping in Claude Code sessions#824

Merged
arnestrickmann merged 1 commit intomainfrom
emdash/scroll-issue-cc-3u4
Feb 11, 2026
Merged

fix(terminal): upgrade xterm.js to 6.0 to fix scroll jumping in Claude Code sessions#824
arnestrickmann merged 1 commit intomainfrom
emdash/scroll-issue-cc-3u4

Conversation

@arnestrickmann
Copy link
Contributor

@arnestrickmann arnestrickmann commented Feb 11, 2026

Summary

  • Upgrades @xterm/xterm from 5.5 to 6.0 and all addons to compatible versions
  • Removes unused @xterm/addon-canvas (eliminated in xterm 6.0)
  • Fixes black viewport bar caused by xterm 6.0's hardcoded #000 background

Context

Users report the terminal auto-scrolling up during Claude Code sessions,
especially during streaming output and after pasting large text. This is
caused by Claude Code's ED3 (Erase in Display mode 3) pattern which clears
the entire scrollback and re-renders every update cycle. xterm.js 6.0 adds
synchronized output support (DEC mode 2026) that batches these clear+rewrite
cycles atomically, preventing the intermediate state that causes scroll jumps.

Refs: xtermjs/xterm.js#5620, anthropics/claude-code#826

Test plan

  • Start a Claude Code agent and trigger long streaming output
  • Scroll up during streaming — viewport should stay in place
  • Paste a large block of text — should not scroll to top
  • Verify no black bars or visual artifacts in terminal
  • Test with other agents (Cursor, Codex) to confirm no regressions
CleanShot 2026-02-11 at 14 24 41@2x The update also brings a scroll bar inside the terminal which makes the UX better

@vercel
Copy link

vercel bot commented Feb 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 11, 2026 10:25pm

Request Review

@greptile-apps
Copy link

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

Upgraded xterm.js from 5.5 to 6.0 to enable synchronized output support (DEC mode 2026), which prevents scroll jumping during Claude Code streaming sessions. The upgrade includes all compatible addon versions and removes the deprecated canvas addon (eliminated in xterm 6.0).

Key changes:

  • Upgraded @xterm/xterm: 5.5.0 → 6.0.0
  • Upgraded @xterm/addon-fit: 0.10.0 → 0.11.0
  • Upgraded @xterm/addon-serialize: 0.13.0 → 0.14.0
  • Upgraded @xterm/addon-webgl: 0.18.0 → 0.19.0
  • Removed @xterm/addon-canvas (deprecated in xterm 6.0)
  • Fixed black viewport bar with background-color: transparent !important in CSS

How this fixes scroll jumping:
xterm.js 6.0 adds synchronized output support that batches Claude Code's ED3 (Erase in Display mode 3) clear+rewrite cycles atomically, preventing the intermediate state that caused viewport jumps during streaming output.

Confidence Score: 5/5

  • Safe to merge - this is a straightforward dependency upgrade with proper CSS fixes
  • All changes are dependency version bumps with compatible versions. The CSS fix addresses a known xterm 6.0 issue. No breaking API changes detected in TerminalSessionManager.ts usage (loadAddon, onContextLoss, allowProposedApi all still work). Lockfiles updated correctly.
  • No files require special attention

Important Files Changed

Filename Overview
package.json Upgraded @xterm/xterm from 5.5 to 6.0 and all addons to compatible versions, removed deprecated @xterm/addon-canvas
src/renderer/index.css Added background-color: transparent !important to fix black viewport bar caused by xterm 6.0's hardcoded background
pnpm-lock.yaml Lockfile updated to reflect xterm 6.0 upgrade and addon version bumps, peer dependencies removed

Sequence Diagram

sequenceDiagram
    participant User
    participant Terminal as Terminal UI
    participant XTerm as xterm.js 6.0
    participant PTY as PTY Process
    
    User->>Terminal: Triggers Claude Code streaming
    PTY->>XTerm: ED3 clear scrollback
    PTY->>XTerm: Stream output chunk 1
    Note over XTerm: Synchronized output enabled<br/>(DEC mode 2026)
    PTY->>XTerm: ED3 clear scrollback
    PTY->>XTerm: Stream output chunk 2
    Note over XTerm: Batches clear+rewrite atomically<br/>(prevents scroll jump)
    XTerm->>Terminal: Render final state
    Terminal->>User: Stable viewport position maintained
Loading

@arnestrickmann arnestrickmann merged commit b6bec0b into main Feb 11, 2026
4 checks passed
@arnestrickmann arnestrickmann deleted the emdash/scroll-issue-cc-3u4 branch February 12, 2026 18:27
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.

1 participant