Skip to content

fix(tui): make ? typeable with /? as the help alias - #612

Merged
AAswordman merged 1 commit into
AAswordman:mainfrom
h4rm00n:fix/tui-help-question-mark-alias
Dec 3, 2026
Merged

AAswordman merged 1 commit into
AAswordman:mainfrom
h4rm00n:fix/tui-help-question-mark-alias

Conversation

@h4rm00n

@h4rm00n h4rm00n commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

变更说明

问题:TUI 中直接键入英文问号 ? 会被全局快捷键拦截并打开帮助面板,导致无法输入问号字符(提问、写 Markdown 等场景都会被卡住)。

方案:

  • 从全局按键处理中移除裸 ? 的帮助绑定(保留 F1);? 此后按普通字符落入输入编辑器;
  • /help 增加别名 /?:内建命令派发加 "?" 分支,命令表(COMMAND_SPECS)加入 ? 条目,使补全弹窗能列出并精确匹配 /?;
  • 帮助面板内容(en/zh help_lines)在 /help 处标注别名;
  • 帮助面板打开时 ? 仍可关闭面板(覆盖层独占键盘期,无输入歧义)。

改动类型

  • Bug 修复

影响范围

  • 平台:桌面 CLI / TUI
  • 模块:apps/cli/src/tui/core/app.rs(全局按键、内建命令派发)、apps/cli/src/tui/input/commands.rs(命令表 + 测试)、i18n 两处 help_lines
  • 用户流程:在输入框键入 ?;通过 /? 或 /help 或 F1 打开帮助面板

验证

cargo check --manifest-path apps/cli/Cargo.toml
# → exit 0

cargo test --manifest-path apps/cli/Cargo.toml -j 4 --lib -- --test-threads=1
# → 160 passed; 0 failed; 3 ignored(含新增 question_mark_help_alias_suggests_and_matches)

python plugins/tools/sync_plugin_packages.py --source runtime --no-hot-reload
# → Done. source=runtime, copied=18, packed=40, plugin_parse_gate 通过

另用隔离环境(独立 XDG/config 目录 + 私有 dbus + tmux 抓帧)做了交互验证:

  1. 输入框键入 ?:字符出现在输入框(> ?),帮助面板不再弹出;
  2. 输入 /? 回车:帮助面板打开;
  3. F1:帮助面板打开(保留的全局键)。

未运行 Flutter 侧测试:本 PR 未改 Flutter/Dart 代码。

截图或日志

复现步骤:TUI 输入框直接敲 ?。修复前面板立即弹出且字符无法输入;修复后字符正常进入输入框,帮助面板经 /?、/help 或 F1 打开。

提交者确认

  • 全部内置及官方扩展包通过生产解析器和注册引擎校验,PR 的 Package parsing 检查通过。
  • 我已阅读 CONTRIBUTING.md。
  • 我已按 CLA.md 的流程签署协议,或提供了覆盖本次贡献的既有签署记录;所有共同贡献者均有相应签署记录。
  • 我拥有本次提交内容的版权或必要授权。
  • 我已保留第三方代码、资源及其许可证和版权声明。
  • 我没有提交密钥、令牌、个人数据或本地构建产物。
  • 我已更新受影响的文档和测试,或在上文说明了原因。

CLA 签署评论链接:#520 (comment)

A bare ? opened the help panel from the global key handler, so a
question mark could never be typed into the input. Help now lives on
F1 and the /help command; /? joins as a declared alias (command table
entry so the completion popup lists it), and a literal ? falls through
to the input editor like any other character. The help panel still
closes on ?, which is safe while the overlay owns the keyboard.

Signed-off-by: h4rm00n <harmoon@qq.com>
@AAswordman
AAswordman merged commit bde7435 into AAswordman:main Dec 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants