Fix hidden, non-remappable Alt+1 Project Explorer binding - #15310
Fix hidden, non-remappable Alt+1 Project Explorer binding#15310warp-agent-staging[bot] wants to merge 1 commit into
Conversation
app/src/workspace/mod.rs registered a FixedBinding for CustomAction::ToggleProjectExplorer, intended only to give the macOS 'View' menu a keyboard-equivalent hint. On non-macOS platforms this FixedBinding gets converted at registration time into a hardcoded, non-editable alt-1 keystroke trigger (see convert_custom_triggers_to_keystroke_triggers), separate from and in addition to the editable 'workspace:left_panel_project_explorer' binding that already exposes the same action via with_custom_action. Because Trigger::Custom bindings are matched by tag rather than by name, this hidden FixedBinding kept matching Alt+1 even after a user removed or remapped the editable binding in Settings > Keyboard shortcuts, and the binding never appeared in the settings/search UI in the first place since only editable bindings are listed there. Remove the redundant FixedBinding entirely, following the same pattern already used elsewhere in this file for actions like CustomAction::ToggleMaximizePane, where a single EditableBinding with with_custom_action(...) is sufficient to drive both the macOS menu item and Settings > Keyboard shortcuts. Confirmed this is a no-op for macOS's View menu, since editable bindings already take precedence over fixed ones when resolving a CustomAction's binding. Adds a regression test verifying that clearing an editable binding exposed via with_custom_action leaves no other binding still resolving a keystroke for that action.
|
This PR was generated with Warp. Comment |
Automated review verdict: Approve (concerns are non-blocking)Root-cause & fix correctnessVerified by code inspection (not just trusting the PR description):
Test verification (re-ran independently)
All reported results confirmed accurate. Test quality note (non-blocking)The new regression test builds a synthetic editable binding ( Other observation (unrelated, non-blocking)The editable No functional or lint issues found. Leaving as draft for human merge; not merging or approving via GitHub review (blocked: reviewer account is the PR author). |


Description
Fixes #15309: Alt+1 always toggled the Project Explorer panel on Windows/Linux, even though this shortcut never appeared in Settings > Keyboard shortcuts and couldn't be remapped or removed.
Root cause:
workspace::init(app/src/workspace/mod.rs) registered aFixedBindingforCustomAction::ToggleProjectExplorer. This binding exists to give the macOS "View" menu a keyboard-equivalent hint for its menu item, sinceapp_menus.rsis macOS-only. Separately, there is already an editable binding (workspace:left_panel_project_explorer) that exposes the sameCustomAction::ToggleProjectExplorervia.with_custom_action(...), which is what actually surfaces in Settings > Keyboard shortcuts.On non-macOS platforms,
AppBuilder::convert_custom_triggers_to_keystroke_triggersconverts every binding with aTrigger::Custommatching this tag into a realTrigger::Keystrokes([alt-1])at registration time — including theFixedBinding, which (being fixed) can never be reassigned or cleared. So even if a user found and cleared the editable binding, this hiddenFixedBindingkept matching Alt+1, and it was never listed in the Settings UI to begin with (only editable bindings are shown there).Fix: Remove the redundant
FixedBindingregistration entirely. This matches the pattern already used elsewhere in the same file for other custom actions (e.g.CustomAction::ToggleMaximizePane), where a singleEditableBindingwith.with_custom_action(...)is sufficient to drive both the macOS menu item and Settings > Keyboard shortcuts — no separateFixedBindingis needed. This is a no-op for macOS's "View" menu, since editable bindings already take precedence over fixed ones when resolving a custom action's binding (confirmed via code inspection).Linked Issue
factory-auto-implement.Testing
test_clearing_custom_action_binding_leaves_no_keystroke_behindinapp/src/util/bindings_tests.rs, which registers an editable binding viawith_custom_action, clears it (simulating the Settings "Clear" button), and asserts no other binding (e.g. a hiddenFixedBinding) still resolves a keystroke for that custom action.cargo check -p warp --lib --bin warp-osspasses.cargo clippy -p warp --all-targets --tests -- -D warningspasses../script/formatproduces no diff.cargo test -p warp --lib— allutil::bindings::tests::*(5) andworkspace::*(209) tests pass../script/runwas not performed in this sandboxed environment (no GUI available); the fix and its behavior were validated via targeted unit tests and code-path analysis instead.Agent Mode
CHANGELOG-BUG-FIX: Fixed a hidden Alt+1 (Ctrl+1 on Mac) binding for Project Explorer that could not be remapped or disabled from Settings > Keyboard shortcuts.