Repository navigation
fix(terminal): align Cursor Agent IME preedit anchor - #14982
Conversation
📝 WalkthroughWalkthroughThe change expands Cursor Agent IME anchor detection to support both initial and follow-up prompts. It adds persistent Cursor Agent state for later composition updates. The candidate anchor now positions and sizes xterm’s Merge Risk: 🟡 Moderate · up to After using Cursor Agent once, later ordinary terminal output beginning with 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c3b212c2-aa55-4cb6-9487-0096956ee3e7
📒 Files selected for processing (4)
src/renderer/src/lib/pane-manager/terminal-ime-anchor.test.tssrc/renderer/src/lib/pane-manager/terminal-ime-anchor.tssrc/renderer/src/lib/pane-manager/terminal-ime-candidate-anchor.test.tssrc/renderer/src/lib/pane-manager/terminal-ime-candidate-anchor.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 7 remain after this review.
| knownCursorAgent: cursorAgentSeen | ||
| }) | ||
| cursorAgentSeen ||= cursorAgentAnchor !== null |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Scope Cursor Agent detection to the active Cursor Agent context.
cursorAgentSeen remains true for the lifetime of this installation. After one Cursor Agent composition, any later non-empty → line can resolve as Cursor Agent input, even when the terminal has returned to ordinary output. This moves the textarea and composition view away from the terminal cursor.
Reset this state when the Cursor Agent context ends, or derive it from durable session metadata. Add a regression test that switches from a recognized Cursor Agent screen to ordinary → output. This preserves normal terminal positioning outside Cursor Agent contexts.
Fixes #14902
Summary
Validation
pnpm typecheckpnpm lint.composition-viewboth moved from PTY cursor row304pxto prompt row112px, with matching rectsM4 Air visual proof
The visible preedit
niis rendered directly on the→ Add a follow-upprompt row.Validation gap
The M4 Air did not have Cursor Agent installed or an enabled CJK input source. The rendered Cursor Agent screen and composition lifecycle were exercised through xterm in the exact dev build; a physical Cursor Agent + native IME keystroke pass was not possible on that machine.