desktop: Chinese IME composition loses trailing characters in the prompt composer
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript
调研方向
Start with packages/app/src/composer/editor/editor.tsx, focusing on the input, keyup, effect, and renderComposerEditor() paths described in the issue. Reproduce with the iFlytek Chinese IME in the OpenCode desktop app and confirm which DOM or selection update aborts composition. The change is done when the composer remains inert during active composition, while normal input and cursor synchronization still work.
由索引模型根据 Issue 内容生成。
描述
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.tsxrunsonInputfor every input event, including composition updates, and writes the parsed DOM into the composer store.onKeyUpsyncs the cursor on every key, including composition keys.- A
createEffectcompares the DOM with the store and callsrenderComposerEditor()(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
- #39632: IME composition breaks on the first keystroke in the v2 prompt input
- #38674: CJK IME composition aborted mid-input (DOM rewrite during 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
- Open a new session in the OpenCode desktop app (2.4.2).
- Focus the prompt composer and switch 讯飞输入法 (iFlytek IME) to Chinese mode.
- Type and commit a short phrase.
- Continue typing another phrase without confirming the IME candidates.
- 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)
- 主要语言
- TypeScript
- 星标
- 230k
- 派生
- 31.3k
- 平均合并
- 5 小时 32 分钟
- 30 天内合并 PR
- 453
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
area/desktop platform/macos status/repro-plausible type/bug version/v2
难度 1/5 1-3 小时 新手友好度 88/100
anomalyco/opencode#67064 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 82/100
anomalyco/opencode#67009 · 2 条评论 ·
维护者通常 1 天内回复
-
area/web type/feature version/v2
难度 2/5 1-3 小时 新手友好度 78/100
anomalyco/opencode#67001 · 3 条评论 ·
维护者通常 1 天内回复
-
skills: a Claude-compatible SKILL.md that fails to parse is dropped without any log可能已有人在做 @liwenjie200543 于 2 天前认领。 未关闭area/plugins platform/linux reproduced type/bug version/v2
难度 2/5 1-3 小时 新手友好度 72/100
anomalyco/opencode#66970 · 4 条评论 ·
维护者通常 1 天内回复
-
tui: Mermaid renderer displays <b>/<strong> tags literally and ignores \n line breaks可能已有人在做 @argszero 于 2 天前认领。 未关闭area/tui platform/wsl status/repro-simulated type/bug version/v2
难度 2/5 1-3 小时 新手友好度 82/100
anomalyco/opencode#66773 · 4 条评论 ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
needs-triage
难度 2/5 1-3 小时 新手友好度 86/100
EPPIcenter/sampledb3#162 ·
-
Particle-1 model未关闭
难度 2/5 1-3 小时 新手友好度 67/100
tashfeenahmed/freellmapi#2169 ·
维护者通常 1 天内回复
-
via-triage
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
🎙️ task - feat(mechanic): pave git.pull.close, a close of a superseded pull with its why on record未关闭
难度 2/5 1-3 小时 新手友好度 72/100
ehmpathy/rhachet-roles-ehmpathy#1576 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
vercel-labs/ui#1563 ·
维护者通常 1 天内回复