IME composition on macOS routes committed text through key-action dispatcher (e.g. "up", "clear" trigger arrow-up / clear-screen instead of being entered)

Resolved 💬 3 comments Opened Apr 19, 2026 by qilinxiaoxiang Closed Apr 19, 2026

Summary

On macOS, when a Chinese IME is active (Sogou or the system-native
Pinyin — both reproduce), typing certain English words and pressing
Enter causes Claude Code's TUI to execute the matching readline
key-action
instead of entering the word as literal text. The text
never makes it into the input buffer.

Confirmed words (all reproduce):
up, down, left, right, home, end, tab, backspace,
delete, escape, clear

These are exactly the Node readline key-name set (plus clear,
which is the action name for Ctrl+L / clear-screen).

Reproduction

  1. macOS 26.3.1 (Darwin 25.3.0), Claude Code 2.1.114.
  2. Switch to a Chinese IME (Sogou 拼音 OR macOS native 拼音 — both

reproduce).

  1. At the Claude Code prompt, type up, press Enter.
  2. Expected: the string "up" is submitted as a user message.
  3. Actual: no message submitted; the input area scrolls to the

previous history entry, as if the physical Up arrow was pressed.

  1. Repeat with clear → current input line gets wiped instead of

submitted. Repeat with each of the other words → each triggers
its corresponding readline action.

NOT reproducible in

macOS Terminal.app / iTerm2 running plain zsh with the same IME
active: up\n arrives as literal text and zsh tries to run it as
a command (zsh: command not found: up). So this is specific to
Claude Code's TUI input handling, not the OS / terminal / IME.

Best guess at root cause

When the IME commits composed text via Enter, the commit path in
Claude Code's Ink-based input handler appears to route the committed
byte burst through a key-action dispatcher (where strings like
"up" and "clear" match Node readline key-names), rather than
through the plain text-insertion path. Normal typing (no IME
composition) goes through the byte/keycode path and is unaffected.

Environment

  • OS: macOS 26.3.1 (Darwin 25.3.0)
  • Shell: zsh
  • IME: Sogou 拼音 + macOS 原生拼音 (both reproduce)
  • Claude Code: 2.1.114

Impact

Any Chinese user who happens to compose one of these readline-named
words in English gets silently-swallowed input. clear is
particularly bad because it wipes what the user just typed without
warning.

Suggested fix

IME-committed text should always go through the literal-insert path,
never the action-name dispatch path. Alternatively, the action-name
lookup should require a real key event (not a string that happens to
match an action name).

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗