[BUG] Chinese IME + slash command: pressing Enter during IME composition clears input instead of executing command
Bug Description
When typing a slash command (e.g. /clear) with Chinese IME active in Ghostty terminal on macOS, pressing Enter to confirm the IME candidate causes the input text to disappear without executing the command.
Environment
- Claude Code version: 2.1.108
- Terminal: Ghostty
- OS: macOS (Darwin 25.3.0)
- Input method: macOS Chinese IME (Pinyin)
Steps to Reproduce
- Open Claude Code in Ghostty terminal
- Make sure Chinese IME is active (e.g., macOS built-in Pinyin input method)
- Type
/clear— the IME shows a candidate popup (e.g.,1 clear 2 吃) - Press Enter to confirm the IME composition
Expected Behavior
The IME candidate is confirmed, and the typed text /clear remains in the input field (or the slash command is executed correctly).
Actual Behavior
The input text disappears entirely. The command is neither executed nor retained.
Additional Context
This issue appears to be a variant of the IME Enter key handling problem previously reported for Japanese IME (#8405, #8423, #8498). The root cause is likely that Claude Code does not distinguish between an IME composition Enter (used to confirm candidate selection) and a regular Enter (used to submit/clear input).
Related issues:
- #8405 — Pressing Enter to confirm IME (Japanese) conversion unintentionally sends the prompt
- #8498 — Japanese IME input causes unintended message submission on Enter key after recent update
- #22853 — Fix IME input for Vietnamese, Chinese, Japanese, Korean (character loss)
- #38694 — Kitty keyboard protocol intercepts Caps Lock, breaking macOS IME switching
The issue is consistently reproducible whenever the IME candidate popup is visible while typing a slash command.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗