Conversation
CI status: the two red tests are pre-existing on
|
macOS 的 ⌘ 键此前由 gpui_shell 在配置表之外单独注册:既不进 default_shortcuts()(解绑/恢复不知道它们),也没有对应的 workspace 动作。 于是解绑 Shell 选择器只写回 Ctrl+K:ReceiveChar,静态 ⌘K 继续抢键(Kuddev#238), ⌘Q 则完全没有绑定。 - display/keymap.rs:新增 MACOS_COMMAND_ALIASES,作为那套 ⌘ 绑定的唯一权威; default_shortcuts() 在 macOS 上把它算进默认键(解绑与恢复同一口径), 设置页展示仍按配置表的 Ctrl 键。 - gpui_shell/workspace/keyboard_bindings.rs:静态 ⌘ 绑定改为从该表派生; Action::Quit 接到与托盘退出同一条路径(先落盘会话与草稿,再停 PTY)。 - 展示层:super 键在 macOS 渲染成 Cmd+,不再出现 Ctrl+Win+F / Win+F。
跨层影子绑定(键位模型不知道壳自己注册的 ⌘ 键)是原因容易被遗忘的一类改动, 按 architecture/notes/AGENTS.md 记一条:单一权威、被否定方案、以及本次明确 不处理的「解绑后 ⌘K 清屏」。
f8b13b2 to
68e815e
Compare
|
Rebased onto
The two failing tests noted above ( |
|
Settled CI on the rebase head (rebase onto
The three red jobs fail only in those two tests, both untouched here and both already red on |
95853ad to
4d08497
Compare
|
Closing this in favour of a replacement PR opened from a rebuilt branch. The diff and the commits are unchanged (4 files, +312/−28); only the branch history differs. |
Result / 用户结果
Fixes #238.
On macOS the shell's ⌘ shortcut set lived outside the keybinding model, so it could not be released, and
Action::Quitwas never wired at all. Now:keybind=Ctrl+K:ReceiveCharandkeybind=cmd+k:ReceiveChar, and ⌘K stops opening the panel immediately, without a restart. Restoring the row brings both keys back.pebrel_settings.txtspell the super modifierCmd+instead ofWin+, soCtrl+Win+F/Win+Fare gone.Users upgrading from a released build must clear the row once more: their existing file predates the alias vocabulary and holds no line for the ⌘ half. Nothing else changes for them —
win+/super+/cmd+stay equivalent inkeybind=lines, and the settings page continues to show the configuration table's keys.Out of scope / 不在本次范围
Unbinding ⌘K does not make it clear the screen, and this PR does not add that. The key is released, not re-bound to anything:
Nonefor a pure ⌘ combination (nebula_app/src/gpui_shell/terminal/keymap.rs:276), so nothing reaches the PTY.nebula_app/src/config/bindings/defaults.rs:367:Esc("\x0c")plusClearHistory), butworkspace_binding_in_contexthas no arm forAction::Esc/Action::ClearHistory, so the shell never implemented it.0x0c, clear scrollback) and deciding whether macOS ⌘K should belong to that action instead of the Shell picker — a default-behavior change. I can submit it separately once the maintainer agrees on scope.Ctrl+Lstill passes through to the shell (defaults.rs:81keeps it asReceiveChar); it clears the screen at the shell level but not the app's scrollback.Design / 设计边界
display::keymapstays the single authority for defaults, unbinding and restoring;gpui_shell/workspace/keyboard_bindings.rsonly translates that table into gpui bindings.MACOS_COMMAND_ALIASESreplaces the second hand-written ⌘ list inbind_macos_command_keys— keeping two copies is what produced the defect.default_shortcuts()gains the alias entries on macOS, deduped against config-table entries that already cover the same action and key. Entries are written verbatim intokeybind=lines because the reload path matches a restored default by string, so the table spelling is the persisted spelling (cmd+…, modifier order as incanonical_combo). Thekeybind=format, thedefault_shortcuts()signature, the settings page contents and the legacy shell are unchanged.Action::Quitmaps to a newQuitAppaction whose handler deferswindowing::quit_all. It is registered inkeyboard_bindings::initbecausenebula_app/src/gpui_shell/workspace.rssits at its hard budget ratchet and cannot grow.architecture/notes/nebula_app/gpui_shell/2026-09-21-macos-command-key-aliases.md— single authority, rejected alternatives, and the ⌘K clear-screen scope note.Evidence / 验证依据
--locked):cargo fmt --all -- --check→ clean.python3 scripts/check_architecture.py --base 3050374→ no errors; pre-existing NOTICEs only; no budget or allowance raised.python3 scripts/check_platform_cfg.py→platform cfg outside platform/: 484 (budget 484)(unchanged).cargo test -p nebula --bin pebrel --features gpui-shell,gpui_platform/runtime_shaders --locked display::keymap→ 14 passed.cargo test -p nebula --bin pebrel --features gpui-shell,gpui-test-support,gpui_platform/runtime_shaders --locked keyboard_bindings→ 7 passed (includes the tab-dispatch tests).cargo test -p nebula-settings --locked→ 67 passed.cargo test --manifest-path tools/i18n-contract/Cargo.toml --locked→ 20 passed, 1 pre-existing ignored.python3 -m unittest scripts.tests.test_architecture_budgets test_architecture_dependencies test_architecture_governance→ 53 passed;... test_pebrel_branding test_windows_resources test_app_icons test_ai_session_probe→ 18 passed, 1 skipped.clearing_releases_the_macos_command_aliasfails without the change with⌘K 必须按表里的写法逐字写回,实际 [("Ctrl+K", "ReceiveChar")]— i.e. the settings write only releases Ctrl+K, exactly the reported bug.macos_command_aliases_round_trip_through_storagepins that every alias entry parses back to the same combination, so a cleared key is never written as an unparsable line.every_macos_command_alias_binds_a_gpui_actionandreleased_cmd_k_is_swallowed_by_no_actionpin the shell wiring: the table has a binding, and the injected no-action binding suppresses the static default atRootand terminal depth.super_modifier_renders_per_platformpins the per-platform keycap.PEBREL_CONFIG_DIR): default ⌘K opens the Shell picker → clearing the row writesCtrl+K:ReceiveChar+cmd+k:ReceiveCharand both ⌘K and Ctrl+K stop opening it without a restart → restoring the row brings ⌘K back → ⌘Q exits andsession.jsonrecordsclean_exit: true; the keymap page showsCtrl+Cmd+Ffor Fullscreen (wasCtrl+Win+F). No layout, translation or DPI surface is touched by this change.default_shortcuts()runs only for the keymap page and keybind reload; the macOS branch adds one linear pass over a 25-entry table.cfg(target_os = "macos")). There is no end-to-end test for ⌘Q — its handler runs the asynchronous draft-approval and session-save path, so it was verified in the real window instead.Required Review / 必须确认
CONTRIBUTING.md,docs/architecture.md, anddocs/project-constraints.md; the decision is recorded underarchitecture/notes/.python3 scripts/check_architecture.py --base 3050374passes; budgets were not inflated to fit the change.Checkboxes explain the review; they do not replace CI or maintainer approval.