CodeWhale icon indicating copy to clipboard operation
CodeWhale copied to clipboard

未适配中文输入法

Open cmdcorp6534 opened this issue 6 months ago • 8 comments

Description

在使用中文输入法时,会造成多种问题。目前我遇到的有:

  1. 在使用中文输入法输入拼音时不会隐藏提示“编写任务或使用 /。” Image

  2. 在有窗口时,例如在配置界面或者是危险操作确认界面,输入的字母会变成拼音在模型输入或斜杠命令输入区显示。 Image Image

Steps to reproduce

  1. 在提示词或斜杠命令输入区使用中文输入法。
  2. 在配置界面或危险操作确认界面等有窗口的界面使用中文输入法。

Expected behavior

  1. 在使用中文输入法输入提示词时应该在输入拼音时隐藏“编写任务或使用 /。”.
  2. 在配置界面或危险操作确认界面等有窗口的界面使用中文输入法时应该将拼音自动替换为普通英文字母输入。

Actual behavior

在 Description 中已经详细描述。

Impact

对正常使用影响不大,但有时会影响操作速度,或者使界面不美观。

Environment

  • OS: Windows 11
  • codewhale version: codewhale 0.8.47 (70743997ca50)
  • Install method: 在 GitHub Release 中下载 codewhale-windows-x64.zip ,然后运行 install.bat
  • codewhale doctor summary: 见下方。
  • Model/provider: DeepSeek
  • Terminal app: Windows Terminal
  • Shell: Windows cmd

CodeWhale Doctor Summary

Version Information: codewhale-tui: 0.8.47 (70743997ca50) rust: unknown

Configuration: ✓ config.toml found at ~.codewhale\config.toml workspace: ~ search_provider: duckduckgo (source: default; set [search] provider = "bing" | "tavily" | "bocha" to switch)

State Root: active: ~.codewhale dual roots: ~.codewhale (primary) + ~.deepseek (legacy)

API Keys: ✓ deepseek: env=no, config=yes · nvidia-nim: env=no, config=no · openai: env=no, config=no · atlascloud: env=no, config=no · wanjie-ark: env=no, config=no · openrouter: env=no, config=no · novita: env=no, config=no · fireworks: env=no, config=no · moonshot: env=no, config=no · sglang: env=no, config=no · vllm: env=no, config=no · ollama: env=no, config=no · xiaomi: env=no, config=no · credential precedence: ~/.deepseek/config.toml, OS keyring, then env ✓ active provider key resolved from config.toml

API Connectivity: · provider: deepseek · base_url: https://api.deepseek.com/beta · model: deepseek-v4-pro · strict_tool_mode: disabled ✓ API connection successful

MCP Servers: ✓ MCP feature flag enabled · MCP config not found at ~.deepseek\mcp.json Run codewhale mcp init or codewhale setup --mcp.

Skills: · local skills dir not found at ~\skills · .agents skills dir not found at ~.agents\skills · global .agents skills dir not found at ~.agents\skills ✓ global skills dir found at ~.codewhale\skills (12 items) · selected skills dir: ~.codewhale\skills

Tools: · tools dir not found at ~.codewhale\tools Run codewhale setup --tools to scaffold a starter dir.

Plugins: · plugins dir not found at ~.codewhale\plugins Run codewhale setup --plugins to scaffold a starter dir.

Storage: · tool-output spillover dir not yet created at ~.deepseek\tool_outputs · composer stash empty (Ctrl+S in the composer to park a draft)

Tool Dependencies: ✓ Python: python → code_execution tool registered ✗ Node.js: not found (tried node) js_execution tool is NOT advertised to the model on this install. Install Node 18+ and ensure node is on PATH: winget install OpenJS.NodeJS (or download from nodejs.org) · pandoc: not found (optional) pandoc_convert tool is NOT advertised to the model. Install pandoc to enable: winget install JohnMacFarlane.Pandoc · tesseract: not found (optional) image_ocr tool is NOT advertised to the model. Install tesseract to enable: winget install UB-Mannheim.TesseractOCR · pdftotext: not found (optional — pure-Rust extractor is the default in v0.8.32) Install Poppler only if you want to opt into pdftotext for column-heavy PDFs.

Terminal Quirks: · no env-driven terminal-quirk overrides active

Platform: OS: windows Arch: x86_64 ! sandbox not available (commands run best-effort)

All checks complete!

cmdcorp6534 avatar May 28 '26 14:05 cmdcorp6534

我试过了 不止dstui,codex也会出现跟你描述的一样的问题 这应该跟tui没有关系 是中文输入法软件本身和底层适配的问题 hunter估计没法改这个

Image

VerrPower avatar May 28 '26 16:05 VerrPower

楼上的朋友说得很有道理;个人建议:在需要输入指令时按一下shift,输入完了再按一下切回来

Aerytgophilis avatar May 30 '26 15:05 Aerytgophilis

Looks like either Windows or the terminal app (you two guys are using) now protects the inline preedit data from being proactively accessed by the client app which retrieves your text input.

It's a good design for user privacy, still.

ShikiSuen avatar Sep 05 '26 11:09 ShikiSuen

谢谢 @cmdcorp6534 把“拼音组合过程中的占位提示”和“弹窗下面的输入泄漏”分开描述,也谢谢 @VerrPower 的跨应用对比、@Aerytgophilis 的临时输入法切换建议,以及 @ShikiSuen 对 preedit(尚未提交的组合文字)边界的分析。这些信息帮助我们避免把两个问题当成同一个问题。

我在输入路由里找到了一个属于 Codewhale 的漏洞:历史搜索开启后,如果上面出现弹窗,带括号粘贴仍会修改被遮住的搜索内容。f9210a4428 已修复这个路径,包含在 0.10.2 候选 PR #6968 中,尚未发布。已有的按键路由会把输入交给弹窗,已有的光标保护也会在弹窗覆盖输入框时隐藏光标;这次补上了历史搜索的粘贴路径。

验证范围:macOS 上 81 个相关 Rust 测试通过、0 失败,其中包含中文粘贴/按键和弹窗保护;还没有 Windows Terminal 的真实输入法验证。当前终端输入路径拿不到尚未提交的拼音 preedit,因此这次不承诺让占位文字在拼音组合开始时就消失,也不声称已解决所有 IME 显示问题。若方便,请用候选版本复测配置/确认弹窗,并注明 Windows Terminal、输入法和版本,以及泄漏的是尚未提交的拼音还是已提交文字;本问题保持开放。

English: thank you for separating preedit display from input escaping a modal. The candidate fixes a concrete Codewhale routing bug: bracketed paste could change hidden history-search text beneath a modal. Existing key routing and covered-composer caret guards remain in place. The focused macOS checks passed (81 passed, 0 failed), but native Windows IME behavior is still unverified. Our current terminal input path does not expose uncommitted preedit, so the placeholder issue is not claimed fixed. A Windows Terminal retest that distinguishes preedit from committed characters would help confirm what remains.

Hmbown avatar Oct 13 '26 06:10 Hmbown

补充 Windows 实测结果:我们已在 Windows 11 ARM64、Windows Terminal 1.24.12741.0 和微软拼音下运行 0.10.2 候选版 cf7199b52e。在 /config 中输入 zhongwen 后按空格,中文 正确进入设置搜索框;关闭窗口后,主输入框仍为空。在普通文件写入确认界面中,拼音提交既没有自动批准操作,也没有进入主输入框。

输入法的预编辑文字/候选框仍显示在终端上一次隐藏光标的位置。这个显示问题还没有解决;终端没有把预编辑状态作为普通文字事件交给应用,所以也不能宣称已解决“正在拼音输入时占位文字仍显示”。f9210a4428 修的是我们确认存在的另一条路由问题:弹窗打开时,粘贴事件不能再修改后台的历史搜索。上述实测不涵盖所有危险操作窗口,欢迎继续提供具体触发步骤。

感谢 @cmdcorp6534 的原始报告,也感谢 @VerrPower 的其他应用对比、@Aerytgophilis 的 Shift 线索以及 @ShikiSuen 对预编辑行为的分析,帮助我们把显示问题与真正的输入泄漏区分开。0.10.2 尚未发布,本问题保持打开。

English: Native candidate testing now confirms that committed Pinyin text goes into the config filter, leaves the composer empty, and neither answers an ordinary write approval nor leaks into the composer. The OS preedit popup still anchors at the terminal's previous hidden cursor position; that visual issue and placeholder behavior remain unresolved. The carrying fix f9210a4428 specifically blocks modal paste from mutating hidden history search. We have not qualified every dangerous-action modal. Thank you all for helping distinguish preedit display from committed-input routing; 0.10.2 is still unreleased.

Hmbown avatar Oct 13 '26 09:10 Hmbown

Update for everyone on this thread (@cmdcorp6534, @VerrPower, @Aerytgophilis, @ShikiSuen): v0.10.2 is now published, and it includes the fix for the Codewhale-side routing bug (bracketed paste could change hidden history-search text underneath a modal, f9210a4428). On Windows 11 ARM64 with Windows Terminal and Microsoft Pinyin, committed pinyin text goes to the config filter, leaves the main input empty, and neither answers a write approval nor leaks into the composer. The fixed-in-main build also parks the hidden terminal cursor at the focused modal input so the IME popup anchors closer to where you are typing. What is not fixed: the preedit text and placeholder still display while composing, because the terminal does not pass uncommitted preedit to the app. If you can retest on v0.10.2 and tell us your terminal, input method, and whether the leaked text was uncommitted pinyin or committed characters, we can narrow what remains. Leaving this open for that display part.

Written by Claude Opus 5.5 for the Codewhale maintainers.

Hmbown avatar Nov 10 '26 21:11 Hmbown

Input-path note (analysis, not a reproduction)

I could not reproduce the remaining ARM64 + Microsoft Pinyin scenario on this machine (x86_64), but the input path explains where committed text can go:

  • ConfigView::handle_key appends every non-control KeyCode::Char to the filter (crates/tui/src/tui/views/mod.rs:4607-4612). There is no explicit search mode; while the panel is open, text is the filter.
  • ViewStack::handle_key routes a key only to the top view (views/mod.rs:1848-1857).
  • A write approval is pushed as ApprovalView (views/mod.rs:7788), so when it is on top it owns the keys.

On this x86_64 machine, driving the TUI through a ConPTY, typing CJK text after /config changes the filter (已筛选设置: 14), confirming the character path above. What is still missing is a timestamped log of the approval push versus the IME commit: if the approval was not the top view at commit time, the text lands in the config filter exactly as reported. That log would decide between "approval lost the top of the stack" and "IME committed before the approval was pushed".

No code change is proposed here; the fix direction (make the approval grab focus, or stop the config filter from consuming text while a pending approval exists) changes settings-panel UX and should be a maintainer decision.

donglovejava avatar Nov 21 '26 07:11 donglovejava

Thanks @donglovejava for tracing the routing: ConfigView taking every character as filter text, ViewStack sending keys only to the top view, and ApprovalView owning keys once it is pushed. That matches our Windows run, where committed pinyin typed with /config open went into the filter and the composer stayed empty. That part works as intended. Your timestamped-log idea is the right way to split 'approval lost the top of the stack' from 'the IME committed before the approval was pushed'. @cmdcorp6534, if committed text still lands in the wrong place on v0.10.3 while an approval is showing, please send the exact steps and we'll add that log. The preedit and placeholder display stays outside what the terminal gives us. If nobody can reproduce the approval case on v0.10.3, we'll close this and link the v0.10.2 fix in f9210a4428.

Written by Claude Fable 5.2 (AI), working with Hmbown.

Hmbown avatar Nov 23 '26 04:11 Hmbown