Skip to content

upgrade xterm.js to v6.0.0#3095

Open
sawka wants to merge 4 commits intomainfrom
sawka/xterm-upgrade
Open

upgrade xterm.js to v6.0.0#3095
sawka wants to merge 4 commits intomainfrom
sawka/xterm-upgrade

Conversation

@sawka
Copy link
Member

@sawka sawka commented Mar 20, 2026

removes lots of special case patches for IME and scrolling that were put in to patch over 5.5.0 issues

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

Walkthrough

This pull request replaces the canvas rendering backend with DOM rendering for the terminal display, updates the xterm library from version 5.5.0 to 6.0.0, and removes the @xterm/addon-canvas dependency. IME composition event handling has been eliminated from the terminal wrapper. Viewport scroll tracking for scroll-to-bottom-on-resize behavior is removed. The changes include updates to type signatures narrowing the renderer union from "webgl" | "canvas" to "webgl" | "dom", modifications to CSS styling for xterm components, and configuration updates to support the new rendering approach.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: upgrading xterm.js to v6.0.0, which is the primary objective reflected throughout all file changes and commit messages.
Description check ✅ Passed The description is directly related to the changeset, explaining that patches for IME and scrolling are being removed because they are fixed upstream in v6.0.0.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sawka/xterm-upgrade

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

}
} else {
if (this.canvasAddon != null) {
if (this.webglAddon == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL: Inverted logic bug - the condition should be != null instead of == null

This is a regression from the old CanvasAddon code. The old logic was: "if already using the requested renderer (canvas), return early to avoid reloading". The new logic should be: "if already using dom (webgl is NOT active), return early".

With the current == null check, when setTermRenderer("dom") is called and webglAddon is null (which happens on initial load or after WebGL context loss), the function returns early without:

  1. Actually ensuring the DOM renderer is active
  2. Cleaning up the webglEnabledAtom state (it stays "true" incorrectly)
  3. Disposing the webglContextLossDisposable

This specifically breaks the WebGL context loss fallback at line 295 - when WebGL loses context, the terminal will be left in a broken state with no active renderer.

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 20, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
frontend/app/view/term/termwrap.ts 281 Inverted logic bug in setTermRenderer() - condition should be != null instead of == null. This breaks WebGL context loss fallback, leaving the terminal in a broken state with no active renderer.
Files Reviewed (6 files)
  • frontend/app/view/term/term-model.ts
  • frontend/app/view/term/term.scss
  • frontend/app/view/term/term.tsx
  • frontend/app/view/term/termwrap.ts (1 critical issue)
  • frontend/app/view/term/xterm.css
  • package.json

Note: This PR upgrades xterm.js from v5.5.0 to v6.0.0 and removes several special-case patches for IME and scrolling that were workaround for v5.5.0 issues. The upgrade appears well-planned, but contains one critical logic bug in the renderer fallback code.


Reviewed by minimax-m2.5-20260211 · 645,807 tokens

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
frontend/app/view/term/term.tsx (1)

303-303: Potential contradiction: overviewRuler configured but hidden in CSS.

The overviewRuler: { width: 6 } is configured here, but in term.scss (lines 131-133), .xterm-decoration-overview-ruler is set to display: none !important. This creates unnecessary configuration overhead. Consider removing this option if the ruler is intentionally hidden, or remove the CSS override if the ruler should be visible.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/app/view/term/term.tsx` at line 303, The component sets
overviewRuler: { width: 6 } while the CSS class .xterm-decoration-overview-ruler
is forcibly hidden; reconcile by either removing the overviewRuler option from
the terminal options in term.tsx (remove the overviewRuler config) if the ruler
is intentionally hidden, or delete the display:none !important rule for
.xterm-decoration-overview-ruler in term.scss so the configured ruler is
visible; pick one approach and remove the conflicting artifact (option or CSS)
so the configuration and styling are consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/app/view/term/xterm.css`:
- Around line 238-246: Remove the stray empty line between the background rule
and the transition declaration to satisfy stylelint; in the CSS block containing
"opacity: 1;", "background:rgba(0,0,0,0);" and "transition: opacity 100ms
linear;", ensure there is no blank line immediately before the "transition:
opacity 100ms linear;" declaration so the declarations are contiguous.

In `@package.json`:
- Around line 85-90: Update the xterm addon dependency versions in package.json
to the v6-compatible releases listed in the review: change `@xterm/addon-fit` to
0.10.0, `@xterm/addon-search` to 0.15.0, `@xterm/addon-serialize` to 0.13.0,
`@xterm/addon-web-links` to 0.11.0, and `@xterm/addon-webgl` to 0.18.0 so they match
`@xterm/xterm`@^6.0.0; locate the dependency entries for "@xterm/addon-fit",
"@xterm/addon-search", "@xterm/addon-serialize", "@xterm/addon-web-links", and
"@xterm/addon-webgl" and update their version strings accordingly, then
reinstall (npm/yarn) to lock the resolved versions.

---

Nitpick comments:
In `@frontend/app/view/term/term.tsx`:
- Line 303: The component sets overviewRuler: { width: 6 } while the CSS class
.xterm-decoration-overview-ruler is forcibly hidden; reconcile by either
removing the overviewRuler option from the terminal options in term.tsx (remove
the overviewRuler config) if the ruler is intentionally hidden, or delete the
display:none !important rule for .xterm-decoration-overview-ruler in term.scss
so the configured ruler is visible; pick one approach and remove the conflicting
artifact (option or CSS) so the configuration and styling are consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7c74b64f-d63c-4148-be83-6ac5e20886f2

📥 Commits

Reviewing files that changed from the base of the PR and between 5f6ccb9 and 9f55242.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • frontend/app/view/term/term-model.ts
  • frontend/app/view/term/term.scss
  • frontend/app/view/term/term.tsx
  • frontend/app/view/term/termwrap.ts
  • frontend/app/view/term/xterm.css
  • package.json

Comment on lines +238 to +246
opacity: 1;

/* Background rule added for IE9 - to allow clicks on dom node */
background:rgba(0,0,0,0);

transition: opacity 100ms linear;
/* In front of peek view */
z-index: 11;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix stylelint error: unexpected empty line before declaration.

Static analysis flagged an empty line before the transition declaration on line 243.

Proposed fix
 .xterm .xterm-scrollable-element > .visible {
 	opacity: 1;
-
 	/* Background rule added for IE9 - to allow clicks on dom node */
 	background:rgba(0,0,0,0);
-
 	transition: opacity 100ms linear;
 	/* In front of peek view */
 	z-index: 11;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
opacity: 1;
/* Background rule added for IE9 - to allow clicks on dom node */
background:rgba(0,0,0,0);
transition: opacity 100ms linear;
/* In front of peek view */
z-index: 11;
}
opacity: 1;
/* Background rule added for IE9 - to allow clicks on dom node */
background:rgba(0,0,0,0);
transition: opacity 100ms linear;
/* In front of peek view */
z-index: 11;
}
🧰 Tools
🪛 Stylelint (17.4.0)

[error] 243-243: Unexpected empty line before declaration (declaration-empty-line-before)

(declaration-empty-line-before)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/app/view/term/xterm.css` around lines 238 - 246, Remove the stray
empty line between the background rule and the transition declaration to satisfy
stylelint; in the CSS block containing "opacity: 1;",
"background:rgba(0,0,0,0);" and "transition: opacity 100ms linear;", ensure
there is no blank line immediately before the "transition: opacity 100ms
linear;" declaration so the declarations are contiguous.

Comment on lines +85 to +90
"@xterm/addon-fit": "^0.11.0",
"@xterm/addon-search": "^0.16.0",
"@xterm/addon-serialize": "^0.14.0",
"@xterm/addon-web-links": "^0.12.0",
"@xterm/addon-webgl": "^0.19.0",
"@xterm/xterm": "^6.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

xterm.js v6.0.0 addon compatibility versions

💡 Result:

For xterm.js v6.0.0, the official GitHub release notes list the compatible versions of official addons: - @xterm/addon-attach: 0.11.0 - @xterm/addon-canvas: 0.7.0 - @xterm/addon-fit: 0.10.0 - @xterm/addon-image: 0.8.0 - @xterm/addon-ligatures: 0.9.0 - @xterm/addon-search: 0.15.0 - @xterm/addon-serialize: 0.13.0 - @xterm/addon-unicode-graphemes: 0.3.0 - @xterm/addon-unicode11: 0.8.0 - @xterm/addon-web-links: 0.11.0 - @xterm/addon-webgl: 0.18.0 Note that the canvas renderer was removed from the core and moved to an addon (@xterm/addon-canvas). All addons are now under the @xterm scope. Some npm pages show slightly higher versions published later, but the release notes specify these as compatible with v6.0.0.

Citations:


Update addon versions to match xterm v6.0.0 compatibility.

Several addons are pinned to versions newer than those officially compatible with @xterm/xterm@^6.0.0. Per the xterm.js v6.0.0 release notes, the compatible addon versions are:

  • @xterm/addon-fit@0.10.0 (currently ^0.11.0)
  • @xterm/addon-search@0.15.0 (currently ^0.16.0)
  • @xterm/addon-serialize@0.13.0 (currently ^0.14.0)
  • @xterm/addon-web-links@0.11.0 (currently ^0.12.0)
  • @xterm/addon-webgl@0.18.0 (currently ^0.19.0)

Update the versions to the officially compatible ranges to ensure stability and avoid potential runtime incompatibilities.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 85 - 90, Update the xterm addon dependency
versions in package.json to the v6-compatible releases listed in the review:
change `@xterm/addon-fit` to 0.10.0, `@xterm/addon-search` to 0.15.0,
`@xterm/addon-serialize` to 0.13.0, `@xterm/addon-web-links` to 0.11.0, and
`@xterm/addon-webgl` to 0.18.0 so they match `@xterm/xterm`@^6.0.0; locate the
dependency entries for "@xterm/addon-fit", "@xterm/addon-search",
"@xterm/addon-serialize", "@xterm/addon-web-links", and "@xterm/addon-webgl" and
update their version strings accordingly, then reinstall (npm/yarn) to lock the
resolved versions.

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