Repository navigation
fix(desktop): 空编辑区快捷键提示按当前平台与 Keymap 生成 - #1936
Merged
Merged
Conversation
空编辑区的“全局搜索”“在项目中查找”快捷键写死为 macOS 符号,Windows 和 Linux 也显示 ⇧⌘O, 且忽略用户在快捷键页的修改。现在两项都从 Keymap 的 Label 生成,与菜单一致;双击 Shift 手势 按平台显示为 ⇧⇧(macOS)或 Shift+Shift(其他平台)。
xiaoyumuxi
marked this pull request as ready for review
November 14, 2026 16:54
31 of 34 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
空编辑区的两条快捷键提示(“全局搜索”“在项目中查找”)写死为 macOS 符号
⇧⇧ ⇧⌘O和⇧⌘F。Windows 和 Linux 上也显示 macOS 按键,并且忽略用户在快捷键页做的修改。菜单和 Find Action 已经从 Keymap 取值,这里是唯一的例外。改动 / Changes
desktop/internal/workbench/shell_view.go:空编辑区两条提示改为a.settings.Keymap.Label("search.everywhere")与Label("search.files")生成,与菜单使用同一来源,平台默认值和用户修改都会生效。desktop/internal/shortcuts/shortcuts.go:新增DoubleShiftLabel()。双击 Shift 是手势而非快捷键,所以不由Label生成。macOS 为⇧⇧,其他平台为Shift+Shift(与Keycaps在非 macOS 上用+连接的风格一致)。desktop/internal/shortcuts/shortcuts_test.go(新增):TestKeycapsOnThisPlatform:按当前运行平台检查Keycaps输出(macOS 为⇧⌘O,其他为Ctrl+Shift+O)。TestDoubleShiftLabelPerPlatform:双击 Shift 文案在两个平台的取值。TestLabelFollowsUserOverride:默认值与用户覆盖后的Label结果。不在本 PR 范围内 / Out of scope
editor-text-tabs功能矩阵条目(其中已描述“空编辑区按当前 Keymap 生成快捷键”,本 PR 让代码与该描述一致)。类型专属:fix
复现与根因
⇧⇧ ⇧⌘O与⇧⌘F;在快捷键页改掉“全局搜索”绑定后,空编辑区仍显示旧按键。shell_view.go中提示文本为字面量,未接入 Keymap。检查项
shortcuts的取值函数写了测试,修复前的失败未单独记录。Keycaps、Label未改签名;DoubleShiftLabel为新增函数。debug_watch.go等处已使用Keycaps。范围检查 / Scope checks
功能矩阵 / Feature matrix
editor-text-tabs条目已描述该行为。插件归属 / Plugin ownership
统一日志系统 / Structured logging
界面文案 / i18n
Shift+Shift,属于快捷键名称(与Ctrl+等符号一样不翻译),没有新的界面词条。逻辑归属 / Logic placement
shortcuts包,本次未新增业务规则,没有需要迁入 Rust Core 的可共享逻辑。性能与内存 / Performance and memory
设置 / Settings
插件契约 / Plugin contract
发行包与资源 / Bundle and resources
无用代码与重构 / Dead code and refactoring
验证 / Verification
gofmt -l检查改动文件go vet ./internal/shortcuts/scripts/desktop/desktop-go.sh test ./internal/shortcuts/ ./internal/workbench/ ./internal/settingswindow/ok,exit 0)未能执行的检查和原因:
TestKeycapsOnThisPlatform和整机显示未在本机执行。本机只有 macOS,需要在对应平台 CI 或真机确认空编辑区显示Ctrl+Shift+O/Ctrl+Shift+F与Shift+Shift。