anomalyco / anomalyco/opencode

m key input gets deleted when fcitx5 IME (Shuangpin/Ziranma) is active in prompt input

Open
#41,920 0 comments 0 reactions 1 assignee View on GitHub

@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
  1. Set fcitx5 IME to Chinese pinyin (Shuangpin/Ziranma)
  2. Focus the opencode prompt input
  3. Press m — character appears then is deleted
  4. Switch IME to English, press m again — works fine

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.