Repository navigation
fix(terminal): restore link hover after mouseleave - #10903
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds mouseleave handling for xterm linkifier hover state. The new disposable listener resets cached hover data when leaving the terminal screen and removes itself during pane disposal. Managed pane initialization and lifecycle teardown now track this disposable. Unit tests cover reset behavior, disposal, missing DOM surfaces, and missing internals. End-to-end coverage verifies URL links deactivate after mouseleave and reactivate on subsequent hover. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts (1)
626-637: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse a screen-capable harness for this lifecycle test.
createOpenTerminalHarnessreturnsnullfromquerySelectorat Line 486, so this test receives the installer’s no-op disposable. It verifies only field assignment and invocation, not removal of the active screen listener. Add a fake.xterm-screen, then assert its listener is removed afterdisposePane.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 41ed1366-cceb-4d57-94d7-c799178f48e4
📒 Files selected for processing (7)
src/renderer/src/lib/pane-manager/pane-dom-creation.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.test.tssrc/renderer/src/lib/pane-manager/pane-lifecycle.tssrc/renderer/src/lib/pane-manager/pane-manager-types.tssrc/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-mouseleave.test.tssrc/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-mouseleave.tstests/e2e/terminal-link-hover-after-worktree-return.spec.ts
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f179f6d8-18aa-42c5-892d-8c6c55fdfce0
📒 Files selected for processing (1)
src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
* fix(terminal): restore link hover after mouseleave * test(terminal): verify mouseleave listener cleanup * test(terminal): assert link hover listener wiring
Summary
mouseleaveevent and disposes the listener with its pane.Screenshots
After the pointer leaves the terminal and returns to the same Claude Code URL cell, the URL hover strip and pointer affordance now recover immediately without clicking, selecting, scrolling, or changing worktrees.
Testing
pnpm lint(targeted Oxlint and formatting checks passed)pnpm typecheck(pnpm run typecheck:webpassed)pnpm test(63 focused tests passed)pnpm build(E2E-mode Electron build passed)Focused verification:
pnpm exec vitest run src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-mouseleave.test.ts src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset.test.ts src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-write.test.ts src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts src/renderer/src/components/terminal-pane/terminal-visibility-resume.test.ts --config config/vitest.config.ts— 63 passedpnpm run typecheck:webpnpm run check:max-lines-ratchetpnpm exec electron-vite build --mode e2e --logLevel errorSKIP_BUILD=1 pnpm exec playwright test tests/e2e/terminal-link-hover-after-worktree-return.spec.ts --reporter=line— 3 passedPerformance Audit
The handler is an O(1) pair of terminal-local cache assignments and runs only on
.xterm-screenmouseleave, not terminal output, typing, render, resize, polling, or visibility hot paths. A local stress measurement completed 1,000,000 handler calls in 2.3 ms and 100,000 install/dispose pairs in 29.4 ms; every one of 100,001 installed listeners was removed and zero listeners remained. The lifecycle regression now asserts the exact listener added duringopenTerminalis removed bydisposePane.AI Review Report
No findings remained. The review traced listener ownership from terminal creation through pane disposal, verified no-op behavior when the xterm screen or private linkifier fields are unavailable, checked synchronous stale-state recovery and event ordering, and confirmed the E2E test targets the same cell without a visibility transition or scroll. A review nit that the lifecycle test initially exercised a no-op disposable was fixed by supplying a real screen-capable harness and asserting the exact add/remove listener pairing. Cross-platform review found no macOS-, Linux-, Windows-, WSL-, SSH-, or folder-workspace-specific assumptions: the change is renderer-local DOM behavior and introduces no shortcuts, labels, filesystem paths, shell commands, or provider-specific logic.
Security Audit
No new IPC, network, authentication, secret, command-execution, filesystem-path, dependency, or untrusted-input surface is introduced. The handler only invalidates terminal-local xterm hover-cache fields, those private accesses remain guarded, and the DOM listener is explicitly removed during pane disposal.
Notes
The reset continues to rely on guarded xterm linkifier internals because xterm exposes no public hover-cache invalidation API. If those fields change in a future xterm release, the behavior safely degrades to the prior cell-change recovery path rather than throwing.