Repository navigation
Description
Operating system
macOS
Orca version
v1.4.183
Details
Short summary
In a Cursor Agent pane, Doubao (and likely other CJK IMEs) paint the xterm.js .composition-view preedit one row below the prompt, while the software caret and the IME candidate window sit on the prompt row. After commit, text usually lands in the input; during composition it flashes under the status line.
This is specific to Cursor Agent's Ink TUI: the PTY cursor is left on the blank line after Ink's trailing \n, and Orca's installTerminalImeCandidateAnchor remaps only textarea, not .composition-view.
What happened?
New Cursor Agent session (header still visible):
Cursor Agent
v2026.08.11-e8db854
Tip: Try Cursor Grok 4.5 …
┌ input ─────────────────────────────────┐
│ → [P]lan, search, build anything │ ← Ink software caret (correct)
│ ┌ 1 多发点 2 等分点 ┐ │ ← Doubao candidate (roughly correct)
└────────────────────────────────────────┘
Cursor Grok 4.6 Extra High Fast · ~/projects/agent · master
d'f'd ← xterm .composition-view (wrong row)
- Keyboard typing into the prompt is fine.
- The visible block/underline caret is on
Pof the placeholder (correct). - Doubao's candidate bubble is near the prompt (textarea remapped).
- The in-terminal preedit (
d'f'd) is drawn under the status line.
On a later follow-up screen (Add a follow-up, header scrolled away) the same IME text can stay one row low even after commit, because the Cursor-agent heuristic bails out.
Does not reproduce in macOS Terminal.app / iTerm with the same cursor-agent binary.
How can we reproduce it?
- macOS, Orca 1.4.183,
cursor-agent2026.08.11-e8db854. - Switch input source to Doubao IME (or another CJK IME that shows an in-terminal preedit).
- Open a new Cursor Agent pane. Confirm the top of the screen still has a full line
Cursor Agentand the placeholder isPlan, search, build anything. - Focus the prompt and start voice input (or type pinyin without committing).
- Observe:
- caret stays on the prompt row
- IME candidate window is near the prompt
- preedit string appears one row below the status line
- Optional: send one turn so the UI becomes
Add a follow-upand theCursor Agentheader scrolls off. Repeat step 4 — remapping often stops entirely.
Expected behavior
.composition-view and the hidden textarea should share the same Cursor Agent input anchor (→ + 1). Preedit should appear on the prompt row, at the software caret.
Related (not duplicates)
- [Bug]: Korean IME preedit overlay hides the character right after the cursor when composing mid-line (macOS) #12545 — Korean IME preedit overlay mid-line (general composition-view geometry)
- [Bug]: Cangjie preedit text remains visible after Backspace cancels composition #11951 — Cangjie preedit leftover
- [Bug]: External Windows speech IME cancels Codex CLI after inserting recognized text in Orca integrated terminal #13829 — Windows speech IME vs Codex (different OS / agent)
- [Bug]: Issues with Korean Input in the Terminal #9803 — Korean input in the terminal
Root cause (from 1.4.183 asar)
Cursor Agent (Ink) renders the prompt, then writes a trailing \n. The PTY cursor sits on the blank line under the status. Ink draws its own caret inside the prompt.
Orca already special-cases this:
// resolveCursorAgentImeAnchor
CURSOR_AGENT_HEADER = "Cursor Agent"
CURSOR_AGENT_INPUT_MARKER = "→"
CURSOR_AGENT_EMPTY_PROMPT = "Plan, search, build anything"
CURSOR_AGENT_HEADER_SCAN_ROWS = 6
// only runs if PTY cursorX === 0 AND that row is blank
// then requires a full-line "Cursor Agent" in the top 6 visible rows
// then finds "→ " and remaps terminal.textareainstallTerminalImeCandidateAnchor moves only textarea.style.top/left.
xterm.js CompositionHelper.updateCompositionElements() then:
- Places
.composition-viewatbuffer.x/buffer.y(the PTY cursor — the blank row). - Moves
textareaback to that same cell. - Both sides use a deferred
setTimeout(0), so they race. Result: candidate window can stay on the prompt (textarea last-wins) while.composition-viewstays on the PTY row.
xterm.css even has: /* TODO: Composition position got messed up somewhere */.
Two extra heuristic holes that break follow-up / newer Cursor CLI:
- Header gate: after one turn the visible top is no longer a lone
Cursor Agentline →hasCursorAgentHeaderis false → remapping disabled. - Empty prompt is hard-coded to
Plan, search, build anything. Current follow-up placeholder isAdd a follow-up, so the line is treated as already-typed and the column jumps to the end of the placeholder.
Suggested fix (Orca)
- In
installTerminalImeCandidateAnchor, apply the same anchor to.composition-view(top/left/height/lineHeight), not justtextarea. - Re-apply after xterm's deferred
updateCompositionElements(rAF or double rAF; currentsetTimeout(0)loses the race). - Drop the “top 6 rows ==
Cursor Agent” requirement. Scan from the bottom for→(already done infindCursorAgentScreenInputAnchor). - Treat
Add a follow-up(and other empty placeholders) as empty, same asPlan, search, build anything.
The durable fix on the agent side is for Cursor CLI to CUP the real PTY cursor onto the prompt cell each frame. That is outside Orca; the four items above make the existing remapper actually win.
Environment
- macOS
- Orca
1.4.183(TERM_PROGRAM=Orca,TERM=xterm-256color) cursor-agent2026.08.11-e8db854- Input method: Doubao IME (
/Library/Input Methods/DoubaoIme.app) — in-terminal preedit + candidate window - Terminal settings at repro: default Cursor Agent pane (reproduced without relying on font/GPU tweaks)
Activity
AmethystLiang commentedon Aug 16, 2026
thanks for reporting. looking into it. there might already be a PR fixing it