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): draw the hardware cursor in remounted panes before first focus - #41736
The terminal library waits for a "you got focus" signal before it ever draws the cursor. When Orca rebuilds a terminal (reload, reattach), focus never "arrives" because it never left, so the signal doesn't fire. agy uses the real terminal cursor, so its cursor goes missing until you press a key. This tells the terminal to draw the cursor right away and only hide it when the app asks.
Files
Added
Deleted
Net
Test
1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$42
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$42
Prod
2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$11
$\color{#cf222e}{\Huge{\mathbf{−}}}$4
$\color{#1a7f37}{\Huge{\mathbf{+}}}$7
What Changed
buildDefaultTerminalOptions() now sets xterm's init-only showCursorImmediately: true. Pane xterms, dashboard previews and the settings preview all use these defaults.
The return type is widened to ITerminalOptions & ITerminalInitOnlyOptions, and createPaneDOM is updated to match.
Added a regression test: a fresh xterm (as after a remount) fed agy's inline frame now has a drawable cursor without focus or input. A second test pins xterm's default behaviour, and a third checks that ?25l still hides the cursor.
Before: after a pane is rebuilt, agy shows no cursor (not even the hollow unfocused outline) until the first keypress, even though agy sent ?25h and xterm reports isCursorHidden=false. After: the cursor follows ?25h/?25l immediately.
Why
xterm only sets coreService.isCursorInitialized in three cases: on a textarea focus event, on a keydown/keypress, or when switching to or from the alternate screen (DECSET/DECRST 1049). The WebGL and DOM renderers skip drawing the cursor while that flag is false. Repro in a dev build: run agy, reload the renderer, and the pane reports isCursorInitialized=false, isCursorHidden=false with the textarea already focused. No cursor appears in five shots spread across the blink cycle, and one keystroke brings it back.
Other agents mostly hide this: Claude Code, Codex and cursor-agent hide the hardware cursor and draw their own, and alt-screen TUIs flip the flag as a side effect. agy draws inline and, in DEC 2026 mode, sends ?25h once and never repeats it, so nothing else re-initializes the cursor.
This is the same root cause and the same fix as the mobile change in #11387. The alternative was re-firing _showCursor from Orca's remount and focus paths, but that means patching each path where focus is kept, and it relies on private xterm API.
Linked Issue
N/A (maintainer; no existing issue for desktop). Related: #11387 (same root cause on mobile), #14632 / #14638 (DECTCEM restore on reattach for "hide/show once" TUIs).
Visual Proof
N/A for an after-capture. The before state was reproduced in a dev Orca over CDP: after a renderer reload, the cursor cell had 0 cursor pixels across 5 shots, and one keystroke brought it back. The after state is covered by the regression test, not by a screen capture.
Testing
I manually tested these changes locally (reproduced the bug on macOS; the after state is not yet checked on screen)
Every added test fails without this change (the first case fails with showCursorImmediately: false)
Also ran pnpm typecheck and the pane-manager, dashboard-popout and settings/terminal suites: 26 files, 58 tests passing.
Risk
Level: Low
A brand-new terminal now shows its cursor before the first focus or keystroke. This is standard behaviour in other terminals. A shell pane that was never focused will show the unfocused outline cursor instead of nothing. Apps that hide the cursor (?25l) are unaffected. Renderer-only and cross-platform, with no impact on saved data, SSH or mobile. To back it out, a plain revert is enough.
…st focus
xterm withholds the cursor until its textarea gets a focus event or a
keystroke. A remounted pane (reload, reattach) keeps DOM focus, so no
event fires and TUIs that use the hardware cursor, like agy, show no
cursor until the next keypress. Set showCursorImmediately so DECTCEM
alone decides visibility, matching the mobile fix in #11387.
Default pane terminal options now set showCursorImmediately to true and include the initialization-only options type. Pane DOM creation types merged terminal options with the same intersection. A new test checks cursor initialization and visibility after a fresh terminal processes an inline-agent frame.
Merge Risk: Minimal · up to 1474c
This change makes the terminal cursor appear immediately after a pane is rebuilt, and nothing found blocks merging. The remaining feedback only suggests stronger test coverage.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the terminal cursor is drawn in remounted panes before first focus. It matches the changeset, which sets showCursorImmediately to true in the default xterm options and…
Description check
The description follows the template closely. It has ELI5, What Changed, Why, Linked Issue (N/A with related issues cited), Visual Proof (N/A with reason and a reproduction note), Testing with checkbo…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the terminal cursor is drawn in remounted panes before first focus. It matches the changeset, which sets showCursorImmediately to true in the default xterm options and widens the return type. The title is a conventional fix(terminal) commit subject and is specific enough for a teammate scanning history.
Full details: Description check
Explanation
The description follows the template closely. It has ELI5, What Changed, Why, Linked Issue (N/A with related issues cited), Visual Proof (N/A with reason and a reproduction note), Testing with checkboxes, Risk with level Low and a revert path, and a Checklist. The Review, Notes, and AI Disclosure sections are absent or not filled in. The Agent skill boundary section is marked. The Linked Issue section does not contain a 'Fixes #' link, which the template says should always exist for outside contributors. The author states they are a maintainer, so this is acceptable. The Visual Proof section gives a reproduction note but no before/after capture. The template asks for one for UI or behavior changes, and the author explains why it is not provided.
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.
34-37: Trivial · Maintainability & Code Quality · Heavy lift
Add coverage for the rendered cursor.
This assertion checks private flags on a terminal that the test never opens. It can pass even if the renderer does not draw the cursor before focus or input.
Add a browser-level test that opens the terminal, writes the frame without focus or input, and checks the rendered cursor. Also check that ?25l hides it.
Based on learnings, tests should assert observable outputs rather than private state.
Source: Learnings
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: c4043585-6b52-416d-9951-61be1ca59e51
Commits
Reviewing files that changed from the base of the PR and between 9ac4894 and 1474c44.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
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
The terminal library waits for a "you got focus" signal before it ever draws the cursor. When Orca rebuilds a terminal (reload, reattach), focus never "arrives" because it never left, so the signal doesn't fire.
agyuses the real terminal cursor, so its cursor goes missing until you press a key. This tells the terminal to draw the cursor right away and only hide it when the app asks.What Changed
buildDefaultTerminalOptions()now sets xterm's init-onlyshowCursorImmediately: true. Pane xterms, dashboard previews and the settings preview all use these defaults.ITerminalOptions & ITerminalInitOnlyOptions, andcreatePaneDOMis updated to match.?25lstill hides the cursor.Before: after a pane is rebuilt,
agyshows no cursor (not even the hollow unfocused outline) until the first keypress, even though agy sent?25hand xterm reportsisCursorHidden=false.After: the cursor follows
?25h/?25limmediately.Why
xterm only sets
coreService.isCursorInitializedin three cases: on a textarea focus event, on a keydown/keypress, or when switching to or from the alternate screen (DECSET/DECRST 1049). The WebGL and DOM renderers skip drawing the cursor while that flag is false. Repro in a dev build: runagy, reload the renderer, and the pane reportsisCursorInitialized=false,isCursorHidden=falsewith the textarea already focused. No cursor appears in five shots spread across the blink cycle, and one keystroke brings it back.Other agents mostly hide this: Claude Code, Codex and cursor-agent hide the hardware cursor and draw their own, and alt-screen TUIs flip the flag as a side effect. agy draws inline and, in DEC 2026 mode, sends
?25honce and never repeats it, so nothing else re-initializes the cursor.This is the same root cause and the same fix as the mobile change in #11387. The alternative was re-firing
_showCursorfrom Orca's remount and focus paths, but that means patching each path where focus is kept, and it relies on private xterm API.Linked Issue
N/A (maintainer; no existing issue for desktop). Related: #11387 (same root cause on mobile), #14632 / #14638 (DECTCEM restore on reattach for "hide/show once" TUIs).
Visual Proof
N/A for an after-capture. The before state was reproduced in a dev Orca over CDP: after a renderer reload, the cursor cell had 0 cursor pixels across 5 shots, and one keystroke brought it back. The after state is covered by the regression test, not by a screen capture.
Testing
pane-terminal-cursor-initialization.test.ts)showCursorImmediately: false)Also ran
pnpm typecheckand the pane-manager, dashboard-popout and settings/terminal suites: 26 files, 58 tests passing.Risk
Level: Low
A brand-new terminal now shows its cursor before the first focus or keystroke. This is standard behaviour in other terminals. A shell pane that was never focused will show the unfocused outline cursor instead of nothing. Apps that hide the cursor (
?25l) are unaffected. Renderer-only and cross-platform, with no impact on saved data, SSH or mobile. To back it out, a plain revert is enough.Agent skill upstream boundary
Checklist