[BUG] CJK IME (Chinese/Japanese/Korean) preedit & candidate window anchored to wrong position on macOS (real cursor not moved)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using CJK IME (Chinese/Japanese/Korean) on macOS, the IME preedit and candidate window are
anchored to the terminal’s default cursor position (bottom-left / last real cursor), not to the
caret position shown in Claude Code’s TUI. The IME overlay does not follow left/right caret
movements inside the input line.
What Should Happen?
IME preedit text and candidate window should follow the caret position inside the Claude Code
input line, moving as the caret moves.
Error Messages/Logs
No explicit error messages. Behavior issue only.
Steps to Reproduce
- Launch Claude Code in a macOS terminal (Terminal.app / iTerm2 / Warp / Ghostty).
- Focus the input line.
- Switch IME to Chinese Pinyin (Squirrel/Rime).
- Type “ni hao”, then move caret left/right.
- Observe IME preedit & candidate window position.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
None
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Likely cause: Claude Code renders a “fake cursor” in the TUI but does not move the real terminal
cursor to the caret position. macOS IME anchors the preedit/candidate window to the real cursor/
caret rect, so it stays at the last real cursor position.
Workaround (tested locally): after each render, move the real terminal cursor to the caret
position (CUP), preserving/restoring SGR state. This makes IME preedit/candidate window follow
the caret correctly across terminals.
Before:
<img width="1750" height="1152" alt="Image" src="https://github.com/user-attachments/assets/76b740be-7879-4c56-94a1-a3dbbc91f3f1" />
After by me hacked:
<img width="1726" height="1086" alt="Image" src="https://github.com/user-attachments/assets/531f240a-9beb-4547-b1b3-8c707def31d0" />
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗