You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(terminal): blink the DOM block cursor to each cell's own colours so coloured prompt lines keep their background - #50986
With GPU rendering off (or when Orca falls back to the DOM renderer), the blinking block cursor punched a hole in coloured lines. On its "off" blink it showed the plain terminal background instead of the line's colour, so coloured prompt bands (agent TUIs, powerline prompts) flickered with a dark square. After about 5 idle minutes, when the cursor stops blinking, it could vanish completely on those coloured cells. Now the off blink shows whatever is really underneath the cursor, and a cursor that is not blinking always stays visible.
What Changed
Before (DOM renderer, block cursor on a cell with its own background):
Blink off phase: the cell lost its background (transparent row background showed through) and its glyph was drawn in the cursor colour.
Not blinking (blink idle after 5 minutes, rows without xterm-focus): on truecolor and selected cells the cell's inline background won over the cursor colour, so the cursor was invisible.
After:
Blink off phase: the cell shows its own background and text colours (truecolor, palette and selection alike).
Blink on phase and every non-animating state: a solid cursor in the cursor colours. Default cells look the same as before.
Mechanism:
xterm source patch, DomRenderer._injectCss (config/patches/xterm-src/@[email protected]): the block blink keyframe now holds the cursor colours for 0%, 50% and drops the 50% { background-color: inherit } step. The animation uses step-start, so the second half jumps to the implicit 100% keyframe, which is the cell's own computed style (Orca's inline truecolor background or the xterm-bg-N class).
The plain (non-!important) block cursor rule is removed. The existing !important rule now covers every block cursor that is not animating: blink off, rows without xterm-focus, and blink idle. It is not applied to the animating cursor because !important would beat the animation.
terminal-dom-block-fill.ts: a block cursor sitting on a U+2580–U+2595 block glyph keeps the seam-free gradient fill, but painted in currentColor and without forcing inline color: transparent. The fill now follows the cursor's animated colour, so a cursor on █ still blinks and stays solid when it stops. Already-filled cursor spans take the early return, and cursor spans skip the getComputedStyle read.
The minified @xterm/xterm patch and its lockfile hash are regenerated output of regenerate-xterm-patches.mjs --write (a token diff of the built xterm.js/xterm.mjs shows only these CSS strings).
Why
The bad keyframe and the non-!important base rule are upstream xterm.js code (unchanged on xterm.js master). Orca already patches the DOM row factory to write truecolor backgrounds as inline styles, so the fix belongs in the same patch. Alternatives considered: revert/revert-layer keyframe values or a per-cell CSS variable need more moving parts and would make the row factory resolve every cell colour; the implicit 100% keyframe already gives the exact cell colours. Keeping the plain block rule alongside the new keyframe would make it the underlying value, leaving palette cells cursor-coloured in the off phase.
Headless Chrome with xterm 6.1.0-beta.336 (DOM renderer), main's patch vs this branch's patch. Line abcXYZ with a truecolor background band, cursor on X. Blink phases are frozen with the Web Animations API; the idle case adds the xterm-cursor-blink-idle class xterm sets after 5 minutes.
State
Before (main)
After (this PR)
Truecolor cell, blink off phase
Truecolor cell, blink idle
Palette background cell, blink off phase
Selected truecolor cell, blink off phase
Red █ on truecolor, blink on / off (after)
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Reproduced on macOS (m4air) in headless Chrome over CDP with the DOM renderer, loading the npm @xterm/[email protected] tarball with main's patch and with this branch's patch. For truecolor, palette, selected, truecolor-foreground and default cells × blink on, blink off, blink idle, unfocused rows and cursorBlink=false, read the cursor's computed background-color/color. Main: off phase transparent on every coloured cell; idle and unfocused rows invisible on truecolor and selected cells. Branch: off phase keeps each cell's colours (e.g. rgb(48, 48, 48) band, rgb(52, 101, 164) palette blue); every other state is a solid cursor.
Cursor on a red █ with an 80px line height, live animation sampled 2px from the cell top (outside the font glyph): blinking alternates accent/cell colour, static stays solid accent, matching main's static fill with no cursor-coloured strips.
New terminal-dom-block-fill.test.ts (happy-dom): the block cursor span keeps its inline colour, gets the currentColor fill and is idempotent across passes. Fails on main (expected 'transparent' to be 'rgb(255, 0, 0)'), passes here.
Targeted vitest: terminal-rendering/ plus the xterm smoke tests terminal-capability-replies and terminal-restore-sgr-latch (97 passed). regenerate-xterm-patches.mjs --check passes (all 5 packages in sync, including the lockfile hash). oxlint, oxfmt, anti-slop, ast-grep and the changed-code quality gate are clean.
The change is renderer CSS plus a renderer DOM helper, identical on macOS, Linux and Windows; not run in a packaged Windows/Linux build.
Performance: the CSS runs once per theme change in _injectCss, not per cell. Blink idle over 10 s of real blinking: RecalcStyleCount 610/607 (main) vs 605/608, RecalcStyleDuration 26–37 ms vs 28–31 ms, no layout either way. Stream render of 3000 lines × 150 truecolor/palette SGR cells at 160×50: 1834/1632/1453 ms vs 1465/1435/1456 ms. fillBlockSpan (DOM row render path) only does extra work for the single cursor span on a block glyph, and that span now skips main's getComputedStyle; happy-dom passes are within noise (81-span row, median repass 0.043/0.026 ms vs 0.022/0.018 ms). Each terminal injects and fills its own rows with no shared state, so per-update cost at N=200 panes is unchanged.
Risk
Level: Low
Only the DOM renderer's block cursor changes; bar, underline and outline cursors and the WebGL renderer are untouched. The riskiest part is the !important rule for non-animating block cursors: on a selected or decorated cell the cursor now draws over the selection colour (as cursorBlink=false already did upstream), and in the off phase a selected cell shows the selection colour instead of transparent. The off-phase glyph now uses the cell's own foreground, matching the WebGL renderer. Back out with a plain revert (the xterm patch and lockfile hash revert together).
Review
Cross-platform: CSS and a renderer DOM helper only, no platform branches.
SSH and remote: rendering happens in the desktop renderer, so remote panes behave the same; no protocol change.
Agents: none affected beyond agent TUIs that paint coloured input lines now rendering correctly.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
The same keyframe bug exists in xterm.js master and can be reported upstream separately.
The DOM fill logic now uses currentColor for block-cursor fills and preserves the cursor’s text color. A new test checks cursor color, fill foreground, and background image after repeated calls to applyDomBlockFills. The xterm CSS patch updates block-cursor blink keyframes and timing. It also applies important cursor-color rules to non-blinking cursors, cursors in unfocused rows, and cursors in idle-blink rows.
Severity of issue fixed: Medium
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Out of Scope Changes check
The xterm patch, its regenerated hash, and the addon patches are tied to the DOM renderer block-cursor CSS in #50985, so they are in scope. The head diff (merge base 72810b9 to head 374eee6) also ch…
Explain in the PR description how terminal-dom-block-fill.ts changes support #50985, and correct the statement that no automated test was added. If the change is not needed for the issue, remove it from this PR.
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title names the main change: the DOM block cursor now blinks using each cell's own colours, so coloured prompt lines keep their background. It matches the patch (keyframe, step-start, !important r…
Description check
The description follows the repository template. It has ELI5, What Changed (before and after, plus mechanism), Why (with alternatives), Linked Issue (Fixes #50985), Visual Proof (an image link), Testi…
Linked Issues check
Linked issue #50985 is the only active direct target. Its requirements are coding requirements: (1) in the blink-off phase, a block cursor on a coloured cell shows that cell's own background and text …
Full details: Title check
Explanation
The title names the main change: the DOM block cursor now blinks using each cell's own colours, so coloured prompt lines keep their background. It matches the patch (keyframe, step-start, !important rule) and the new terminal-dom-block-fill changes. It is specific and follows the fix(terminal) convention. It is long (115 characters), but the content is accurate.
Full details: Description check
Explanation
The description follows the repository template. It has ELI5, What Changed (before and after, plus mechanism), Why (with alternatives), Linked Issue (Fixes #50985), Visual Proof (an image link), Testing with a detailed manual headless Chrome check, Performance with a reason, Risk with level and backout, AI Disclosure, Review, and Checklist. The Visual Proof image is a placeholder-like link, and the test-anti-pattern box and the lint/typecheck/test/build checklist item are unchecked. Those gaps are minor and do not make the description incomplete.
Full details: Linked Issues check
Explanation
Linked issue #50985 is the only active direct target. Its requirements are coding requirements: (1) in the blink-off phase, a block cursor on a coloured cell shows that cell's own background and text colour; (2) after blink idle, the block cursor stays visible on truecolor cells. The patch change in config/patches/xterm-src/@[email protected] (DomRenderer.ts _injectCss) keeps only the on-phase keyframe (0%, 50% with cursor colours), so the off phase reaches the implicit 100% keyframe, which is the cell's computed style. It uses step-start for the block animation. It replaces the non-!important block cursor rule with an !important rule covering blink off, unfocused rows, and blink idle. The previous conclusion still holds, because the patch hunk was not changed since the previous review. Verification is author-reported (headless Chrome computed-style check). The issue does not require an automated test. The lockfile hash in pnpm-lock.yaml is an ignored file; its contents were not inspected. The newly changed src/renderer/src/lib/pane-manager/terminal-rendering/terminal-dom-block-fill.ts also affects block-cursor spans, but this assessment does not establish how it interacts with the off-phase result; the patch-level evidence above is unchanged.
Full details: Out of Scope Changes check
Explanation
The xterm patch, its regenerated hash, and the addon patches are tied to the DOM renderer block-cursor CSS in #50985, so they are in scope. The head diff (merge base 72810b9 to head 374eee6) also changes src/renderer/src/lib/pane-manager/terminal-rendering/terminal-dom-block-fill.ts (+14/-5). In block-cursor spans, it uses currentColor for the fill, keeps the cursor's span colour instead of setting it to transparent, and adds terminal-dom-block-fill.test.ts (+23). This is in the DOM renderer block-cursor area, so it is not shown to be unrelated. However, the PR description does not mention this file. Its Mechanism section lists only the patch hunk. The description also says no automated test was added, but a test file exists. The link between this file and #50985 is not explained.
Resolution
Explain in the PR description how terminal-dom-block-fill.ts changes support #50985, and correct the statement that no automated test was added. If the change is not needed for the issue, remove it from this PR.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
…so coloured prompt lines keep their background
In the DOM renderer the block cursor's blink-off keyframe set
`background-color: inherit`, which took the transparent row background
and punched a hole into coloured prompt bands. The non-blinking block
cursor rule was not `!important`, so inline truecolor and selection
backgrounds hid the cursor once blinking went idle or rows lost focus.
The xterm source patch now holds the cursor colours for `0%, 50%` with
`step-start`, so the off half falls back to the cell's own colours, and
one `!important` rule covers every non-animating block cursor (blink
off, unfocused rows, blink idle). The block-element fill keeps block
cursor spans drawn in currentColor so a cursor on a block glyph still
blinks and stays solid when it stops.
Fixesstablyai#50985
Co-authored-by: Neil <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
With GPU rendering off (or when Orca falls back to the DOM renderer), the blinking block cursor punched a hole in coloured lines. On its "off" blink it showed the plain terminal background instead of the line's colour, so coloured prompt bands (agent TUIs, powerline prompts) flickered with a dark square. After about 5 idle minutes, when the cursor stops blinking, it could vanish completely on those coloured cells. Now the off blink shows whatever is really underneath the cursor, and a cursor that is not blinking always stays visible.
What Changed
Before (DOM renderer, block cursor on a cell with its own background):
xterm-focus): on truecolor and selected cells the cell's inline background won over the cursor colour, so the cursor was invisible.After:
Mechanism:
DomRenderer._injectCss(config/patches/xterm-src/@[email protected]): the block blink keyframe now holds the cursor colours for0%, 50%and drops the50% { background-color: inherit }step. The animation usesstep-start, so the second half jumps to the implicit 100% keyframe, which is the cell's own computed style (Orca's inline truecolor background or thexterm-bg-Nclass).!important) block cursor rule is removed. The existing!importantrule now covers every block cursor that is not animating: blink off, rows withoutxterm-focus, and blink idle. It is not applied to the animating cursor because!importantwould beat the animation.terminal-dom-block-fill.ts: a block cursor sitting on a U+2580–U+2595 block glyph keeps the seam-free gradient fill, but painted incurrentColorand without forcing inlinecolor: transparent. The fill now follows the cursor's animated colour, so a cursor on█still blinks and stays solid when it stops. Already-filled cursor spans take the early return, and cursor spans skip thegetComputedStyleread.@xterm/xtermpatch and its lockfile hash are regenerated output ofregenerate-xterm-patches.mjs --write(a token diff of the builtxterm.js/xterm.mjsshows only these CSS strings).Why
The bad keyframe and the non-
!importantbase rule are upstream xterm.js code (unchanged on xterm.js master). Orca already patches the DOM row factory to write truecolor backgrounds as inline styles, so the fix belongs in the same patch. Alternatives considered:revert/revert-layerkeyframe values or a per-cell CSS variable need more moving parts and would make the row factory resolve every cell colour; the implicit 100% keyframe already gives the exact cell colours. Keeping the plain block rule alongside the new keyframe would make it the underlying value, leaving palette cells cursor-coloured in the off phase.Linked Issue
Fixes #50985
Visual Proof
Headless Chrome with xterm 6.1.0-beta.336 (DOM renderer), main's patch vs this branch's patch. Line
abcXYZwith a truecolor background band, cursor onX. Blink phases are frozen with the Web Animations API; the idle case adds thexterm-cursor-blink-idleclass xterm sets after 5 minutes.█on truecolor, blink on / off (after)Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Reproduced on macOS (m4air) in headless Chrome over CDP with the DOM renderer, loading the npm
@xterm/[email protected]tarball with main's patch and with this branch's patch. For truecolor, palette, selected, truecolor-foreground and default cells × blink on, blink off, blink idle, unfocused rows andcursorBlink=false, read the cursor's computedbackground-color/color. Main: off phase transparent on every coloured cell; idle and unfocused rows invisible on truecolor and selected cells. Branch: off phase keeps each cell's colours (e.g.rgb(48, 48, 48)band,rgb(52, 101, 164)palette blue); every other state is a solid cursor.Cursor on a red
█with an 80px line height, live animation sampled 2px from the cell top (outside the font glyph): blinking alternates accent/cell colour, static stays solid accent, matching main's static fill with no cursor-coloured strips.New
terminal-dom-block-fill.test.ts(happy-dom): the block cursor span keeps its inline colour, gets thecurrentColorfill and is idempotent across passes. Fails on main (expected 'transparent' to be 'rgb(255, 0, 0)'), passes here.Targeted vitest:
terminal-rendering/plus the xterm smoke teststerminal-capability-repliesandterminal-restore-sgr-latch(97 passed).regenerate-xterm-patches.mjs --checkpasses (all 5 packages in sync, including the lockfile hash). oxlint, oxfmt, anti-slop, ast-grep and the changed-code quality gate are clean.The change is renderer CSS plus a renderer DOM helper, identical on macOS, Linux and Windows; not run in a packaged Windows/Linux build.
Performance: the CSS runs once per theme change in
_injectCss, not per cell. Blink idle over 10 s of real blinking: RecalcStyleCount 610/607 (main) vs 605/608, RecalcStyleDuration 26–37 ms vs 28–31 ms, no layout either way. Stream render of 3000 lines × 150 truecolor/palette SGR cells at 160×50: 1834/1632/1453 ms vs 1465/1435/1456 ms.fillBlockSpan(DOM row render path) only does extra work for the single cursor span on a block glyph, and that span now skips main'sgetComputedStyle; happy-dom passes are within noise (81-span row, median repass 0.043/0.026 ms vs 0.022/0.018 ms). Each terminal injects and fills its own rows with no shared state, so per-update cost at N=200 panes is unchanged.Risk
Level: Low
Only the DOM renderer's block cursor changes; bar, underline and outline cursors and the WebGL renderer are untouched. The riskiest part is the
!importantrule for non-animating block cursors: on a selected or decorated cell the cursor now draws over the selection colour (ascursorBlink=falsealready did upstream), and in the off phase a selected cell shows the selection colour instead of transparent. The off-phase glyph now uses the cell's own foreground, matching the WebGL renderer. Back out with a plain revert (the xterm patch and lockfile hash revert together).Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
The same keyframe bug exists in xterm.js master and can be reported upstream separately.
Original fix by @mmarabel in #50986
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)