Part of map #1
Question
Build the PoC for (c) — user-definable keybindings + squash-selected-commits — per the design settled in #3, #5 and #8, as a single PR stacked on the bug-f mac-modifier fix branch (fix/mac-primary-modifier, upstream PR noahbclarkson#60), with an upstream feature-request issue created at the same time linking it.
Ship keystroke tests using rgitui_test_support::ViewTest from upstream PR noahbclarkson#59.
Agreed design
Registry — one commands! macro, grouped by view (detail in #5 and #8):
commands! {
view Workspace in rgitui {
CommandPalette "secondary-shift-p";
StageAll "secondary-s" if has_changes;
}
view GraphView in graph {
CopySha "y" if selection;
SquashSelected "secondary-shift-s" if multi_selection;
SelectNext "j" hidden;
}
}
Generates per command: the CommandId variant, the gpui Action struct, the keymap name, the on_action wiring, the availability predicate, the default keystroke, and palette membership. Plus, from the whole set: docs/KEYBINDINGS.md (golden-tested), a JSON Schema for keymap.json, and the default keymap sections.
Keymap file — JSONC keymap.json beside settings.json; Zed-shaped array of {context, bindings} sections with namespace::Action names and null to unbind; file-watched reload = clear_key_bindings() → defaults → user. Default keymap generated from the macro with one comment-headed section per view block.
Migration — all ~36 on_key_down sites. Every overlay gains a key_context (14 have none today); any_overlay_active and the Esc cascade dissolve into context predicates; shared menu::Cancel/menu::Confirm resolved by context depth, except Blame/FileHistory whose Esc is a SwitchToDiff navigation. DetailPanel file search and InteractiveRebase reword mode move to the shared TextInput widget. Global d/b/h/y duplicates and the !panel_has_focus hack are deleted (user-visible: those keys stop firing when focus is unrelated — call it out in the PR).
Defaults use secondary- (Cmd on mac, Ctrl elsewhere).
Conflicts — overlapping-context duplicates (KeyBindingContextPredicate::is_superset) and chord-prefix shadowing. Later-wins with the earlier reported as ignored; prefix dropped for chords; rest of the file still loads. Toast on load plus per-row warnings in the keymap-derived shortcuts view, which marks user-defined bindings distinctly. Tests assert the defaults parse and contain zero conflicts.
Squash — GraphView multi-select as an arbitrary set (ctrl-click toggles, shift-click ranges), mapping list-index ↔ commit-index and skipping virtual worktree rows. SquashSelected validates contiguity and that the selection is on HEAD's first-parent chain, then pre-fills the existing InteractiveRebase dialog (oldest selected Pick, rest of selection Squash, newer Pick).
Part of map #1
Question
Build the PoC for (c) — user-definable keybindings + squash-selected-commits — per the design settled in #3, #5 and #8, as a single PR stacked on the bug-f mac-modifier fix branch (
fix/mac-primary-modifier, upstream PR noahbclarkson#60), with an upstream feature-request issue created at the same time linking it.Ship keystroke tests using
rgitui_test_support::ViewTestfrom upstream PR noahbclarkson#59.Agreed design
Registry — one
commands!macro, grouped by view (detail in #5 and #8):Generates per command: the
CommandIdvariant, the gpuiActionstruct, the keymap name, theon_actionwiring, the availability predicate, the default keystroke, and palette membership. Plus, from the whole set:docs/KEYBINDINGS.md(golden-tested), a JSON Schema forkeymap.json, and the default keymap sections.Keymap file — JSONC
keymap.jsonbesidesettings.json; Zed-shaped array of{context, bindings}sections withnamespace::Actionnames andnullto unbind; file-watched reload =clear_key_bindings()→ defaults → user. Default keymap generated from the macro with one comment-headed section per view block.Migration — all ~36
on_key_downsites. Every overlay gains akey_context(14 have none today);any_overlay_activeand the Esc cascade dissolve into context predicates; sharedmenu::Cancel/menu::Confirmresolved by context depth, except Blame/FileHistory whose Esc is aSwitchToDiffnavigation. DetailPanel file search and InteractiveRebase reword mode move to the sharedTextInputwidget. Globald/b/h/yduplicates and the!panel_has_focushack are deleted (user-visible: those keys stop firing when focus is unrelated — call it out in the PR).Defaults use
secondary-(Cmd on mac, Ctrl elsewhere).Conflicts — overlapping-context duplicates (
KeyBindingContextPredicate::is_superset) and chord-prefix shadowing. Later-wins with the earlier reported as ignored; prefix dropped for chords; rest of the file still loads. Toast on load plus per-row warnings in the keymap-derived shortcuts view, which marks user-defined bindings distinctly. Tests assert the defaults parse and contain zero conflicts.Squash — GraphView multi-select as an arbitrary set (ctrl-click toggles, shift-click ranges), mapping list-index ↔ commit-index and skipping virtual worktree rows.
SquashSelectedvalidates contiguity and that the selection is on HEAD's first-parent chain, then pre-fills the existing InteractiveRebase dialog (oldest selectedPick, rest of selectionSquash, newerPick).