GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — desktop: Chinese IME composition loses trailing characters in the prompt composer · Issue #66985 · anomalyco/opencode

desktop: Chinese IME composition loses trailing characters in the prompt composer #66985

New issue
Copy link
New issue
Copy link
Backlog
Backlog
desktop: Chinese IME composition loses trailing characters in the prompt composer#66985
Copy link
Labels
area/desktopDesktop appplatform/windowsWindowstype/bugSomething is brokenversion/v2OpenCode 2.x

Description

@bobcy2015
bobcy2015
opened on Nov 28, 2026
Issue body actions

Description

Summary

Typing Chinese with 讯飞输入法 (iFlytek IME) in the OpenCode desktop prompt composer intermittently loses the trailing characters that are still in the IME composition buffer. After typing a segment and continuing, the last few pinyin/candidate characters disappear before they are selected or committed. Previously committed text remains. This happens often enough to make Chinese input unusable.

Expected behavior

The IME composition stays active until a candidate is selected/committed; no composing characters are discarded.

Actual behavior

The trailing characters of the active composition vanish. The composition is aborted and the uncommitted pinyin/candidate text is lost; earlier committed text is not affected.

Root cause analysis

This matches the known V2 composer IME issue: the contenteditable editor handles every input/key event during composition and can rewrite its DOM mid-composition.

  • packages/app/src/composer/editor/editor.tsx runs onInput for every input event, including composition updates, and writes the parsed DOM into the composer store.
  • onKeyUp syncs the cursor on every key, including composition keys.
  • A createEffect compares the DOM with the store and calls renderComposerEditor() (editor.replaceChildren(...)) when they differ.
  • Mutating the DOM or selection during an active IME composition makes the browser abort the composition and discard the uncommitted text.

Related

  • Bug: IME composition breaks on the first keystroke in the v2 prompt input #39632: IME composition breaks on the first keystroke in the v2 prompt input
  • Safari: CJK IME composition is aborted mid-input in web app prompt input #38674: CJK IME composition aborted mid-input (DOM rewrite during composition)
  • fix(app): keep the composer editor inert during IME composition #55295: fix(app): keep the composer editor inert during IME composition (closed unmerged; commit f59b00c is not in 2.4.2)

Workaround

Typing Chinese in an external editor and pasting it into the composer works; pasting bypasses IME composition.

Notes

  • Hex voice input is not installed/running on this machine, so its Ctrl+Space hotkey is not involved.
  • No relevant errors in the logs; this is a DOM/IME lifecycle issue, not a server error.

Plugins

superpowers@git+https://github.com/obra/superpowers.git

OpenCode version

2.4.2 (desktop app; bundled CLI 2.4.2)

Steps to reproduce

  1. Open a new session in the OpenCode desktop app (2.4.2).
  2. Focus the prompt composer and switch 讯飞输入法 (iFlytek IME) to Chinese mode.
  3. Type and commit a short phrase.
  4. Continue typing another phrase without confirming the IME candidates.
  5. After a few more keystrokes, the trailing characters in the composition disappear before candidate selection. Earlier committed text remains.

Intermittent but frequent; longer compositions trigger it more often.

Screenshot

No screenshot available (intermittent text loss; textual reproduction above).

Operating System

Windows 10.0.19045 (win32 x64)

Terminal

OpenCode Desktop app (not a terminal client)

Activity

  1. opencodejr
    added
    area/desktopDesktop app
    platform/windowsWindows
    type/bugSomething is broken
    version/v2OpenCode 2.x
    on Nov 28, 2026
  2. opencodejr commented on Nov 28, 2026

    @opencodejr
    opencodejrBot
    on Nov 28, 2026
    Contributor
    More actions

    Thanks for the detailed report and the steps, @bobcy2015.

    I couldn't try this here. It needs the Windows desktop app and a real Chinese IME like 讯飞输入法 composing in the prompt composer, and my sandbox has neither. A maintainer with that setup will need to check it.

    I read the composer editor code (packages/app/src/composer/editor/editor.tsx). On every input event it parses the editor's content into its state, and I didn't find any handling of compositionstart or compositionend there. That fits your analysis, but it doesn't confirm the bug by itself.

    Related issues and PRs:

    • Bug: IME composition breaks on the first keystroke in the v2 prompt input #39632 and Safari: CJK IME composition is aborted mid-input in web app prompt input #38674: IME composition interrupted in the older prompt input. Both were V1 reports and are closed as not planned.
    • [Bug]: Desktop macOS 15: first Chinese character cannot be typed with 微信输入法 / 豆包输入法 IME #41647: first Chinese character lost with an IME on the macOS desktop app (closed).
    • fix(app): keep the composer editor inert during IME composition #55295: a V2 change to leave the editor alone during IME composition. It was closed without being merged.

    Until this is looked at, typing the text elsewhere and pasting it into the composer is the workaround you already found.

  3. fanyzp commented on Nov 28, 2026

    @fanyzp
    fanyzp
    on Nov 28, 2026
    More actions

    reproduced this at the code level — i can't run the windows desktop app with a real ime here, so no live repro, but the mechanism checks out.

    the composer editor has no compositionstart/compositionend handling at all. onInput parses the dom into the store on every input event, including composition updates, and the render effect rewrites the editor dom (replaceChildren) whenever it differs from the store. mutating the dom or the selection mid-composition makes the browser abort it, which is exactly the trailing characters disappearing that you describe. the earlier v2 fix for this (#55295) was closed by automated cleanup without merging, so the bug is still present in dev.

    i put up a fix on a branch (can't open the pr from here — github is rejecting pr creation for my account right now, the branch is at dev...fanyzp:composer-ime-guard): the editor stays inert while a composition is in flight — onInput is gated, keydown dispatch and cursor sync are skipped, the render effect doesn't rewrite the dom, and state is reconciled once from the dom on compositionend. it also covers the safari case where compositionend fires before the confirming enter. regression tests are in packages/app/test-browser/composer-ime.test.ts; they fail on the current code and pass with the fix.

    if a maintainer can try it with a real ime on windows, that would confirm the live behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/desktopDesktop appplatform/windowsWindowstype/bugSomething is brokenversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.