Skip to content

feat(desktop): F1 opens command palette, Cmd+K clears terminal - #8248

Open
complyue wants to merge 2 commits into
esengine:main-v2from
complyue:reasonix/delivery-20260807-191143-4f9886a924
Open

feat(desktop): F1 opens command palette, Cmd+K clears terminal#8248
complyue wants to merge 2 commits into
esengine:main-v2from
complyue:reasonix/delivery-20260807-191143-4f9886a924

Conversation

@complyue

@complyue complyue commented Aug 10, 2026

Copy link
Copy Markdown

背景

桌面端命令面板(Command Palette)原先占用了 Cmd+K / Ctrl+K 全局快捷键,导致集成终端里无法使用 VSCode 风格的 Cmd+K 清屏——终端清屏是高频操作,这个冲突让用户被迫改用其他方式。

该重构最初完成于个人分支 personal/desktop-dev-build(提交 76fda5238),但该分支还混有其他无关改动(构建脚本、IME 提交确认修复等),不适合整体合入。本次将其干净地 cherry-pick 到 main-v2 最新头,形成独立、聚焦的 PR 分支。

目的

  • F1 打开命令面板(各平台与 VSCode 一致;面板打开时聚焦搜索框,Esc 关闭)
  • Cmd+K(macOS)/ Ctrl+K(Windows/Linux)在终端获得焦点时清空屏幕与回滚缓冲,与 VSCode 集成终端语义一致
  • 终端焦点之外,该组合键保持原有原生语义

价值

  • 快捷键语义与 VSCode 对齐,降低认知成本,终端清屏回到肌肉记忆位置
  • 命令面板快捷键与终端清屏解耦,互不抢占
  • 完整配套:新增 terminal-clear-shortcut.test.ts、更新 keyboard-shortcuts.test.ts;en/zh/zh-TW 文案与 GUIDE/GUIDE.zh-CN 文档同步
  • 快捷键可在 Settings → Shortcuts 中重新绑定

变更内容

13 个文件,+152/-19:

  • 核心:keyboardShortcuts.tsApp.tsxCommandPalette.tsxTabBar.tsxTerminalView.tsxstyles.css
  • 测试:__tests__/terminal-clear-shortcut.test.ts(新增)、__tests__/keyboard-shortcuts.test.ts
  • 文案/文档:en/zh/zh-TW locales、docs/GUIDE.mddocs/GUIDE.zh-CN.md

另含 1 行 ratchet 边界调整(tools/repolint/baseline.json):本重构对历史遗留的 5557 行 App.tsx 净 +1 行,将其 file-size budget 4756→4757。已拒绝全量 -update(避免吞入无关债务差异),仅精确调整该文件,理由见提交信息。

验证

  • gofmt / go vet ./... / go run ./tools/repolint 全绿
  • go test ./... 通过;3 个失败均与环境相关,与本次改动无关:internal/remote 2 个单测在超长 $TMPDIR 会话下 unix socket 路径超限(127 > 104 字符,main-v2 对照同样复现);internal/environmentinternal/sandbox 各 1 个单测在全量并发下瞬时超时(单独重跑均通过)
  • 前端测试需 node 环境,本机未安装 node,建议在 CI 中跑 pnpm test

Cache-impact: none - 仅 desktop/frontend TS、docs 与 repolint baseline 调整,不触及 provider 可见的系统提示前缀
Cache-guard: 未改动 internal/tool、internal/provider、internal/boot 等缓存敏感路径,现有 guard 不受影响
Documentation-impact: updated - GUIDE.md 与 GUIDE.zh-CN.md 的快捷键说明随重构同步更新

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Aug 10, 2026
- command palette now opens on F1 on every platform (VSCode convention),
  freeing Cmd+K for the terminal's clear-screen-and-scrollback action
- terminal.clear registered as a first-class shortcut action: while the
  terminal panel has focus, Cmd+K (macOS) / Ctrl+K (Windows/Linux) clears
  the screen and scrollback through the shared shortcut registry, so the
  settings panel, conflict detection, and custom rebinding all apply
- legacy macOS Cmd+K palette bindings are migrated away automatically so
  they cannot shadow terminal.clear
- TabBar kbd hints, shortcut settings/cheatsheet, and docs follow
The cherry-picked Cmd+K refactor (631d84d) nets +1 line in
App.tsx (5556 -> 5557), crossing its ratchet file-size budget
by exactly one line. App.tsx is a legacy 5557-line file whose
budget already tolerates 5556; the refactor needs this line,
so raise this file's budget 4756 -> 4757.

Full -update was rejected: it would rewrite 20+ unrelated
baseline entries that main-v2 changed since the snapshot.
@complyue
complyue force-pushed the reasonix/delivery-20260807-191143-4f9886a924 branch 2 times, most recently from 73fd188 to 95d2e2f Compare August 10, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant