anomalyco / anomalyco/opencode
m key input gets deleted when fcitx5 IME (Shuangpin/Ziranma) is active in prompt input
@simonklee is already working on this.
Since Aug 12, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When fcitx5 IME is active (Chinese pinyin / Shuangpin "Ziranma" scheme) and typing into the prompt input, pressing the m key causes the character to appear and then immediately be deleted (a backspace is swallowed by the input). This only affects m (and similar pure-rhyme keys), and only when the IME is in Chinese mode.
Environment
- OpenCode version: v1.18.16 (also reproduced on current dev)
- OS: Linux (Ubuntu-based), X11
- Terminal: Ghostty 1.3.1 (GTK)
- IME: fcitx5 5.1.7, Shuangpin (Ziranma/Natural Code) scheme
Root cause analysis
In the Ziranma Shuangpin layout, m is the key for the rhyme ian. When the IME is active, fcitx5 intercepts m to start a composition (preedit). Since a standalone rhyme cannot form a valid syllable, fcitx5 sends a backspace to clear the preedit — but that backspace lands in the prompt input, deleting the just-typed m.
Keys that are initials or standalone vowels don't trigger this, which is why only m (and other pure-rhyme keys like l=ai, z=ei...) misbehave.
Related issues
- #39632 (IME composition breaks on the first keystroke)
- #41678, #41647
Expected behavior
The prompt input should properly handle IME composition/preedit so the backspace issued by the IME to manage preedit state is not treated as user input.
Repro steps
- Set fcitx5 IME to Chinese pinyin (Shuangpin/Ziranma)
- Focus the opencode prompt input
- Press
m— character appears then is deleted - Switch IME to English, press
magain — works fine
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.