Skip to content

feat(ui): keyboard shortcuts panel from one binding table (ADR 0073) - #204

Merged
tebriz91 merged 4 commits into
mainfrom
windows/shortcuts-panel
Oct 28, 2026
Merged

tebriz91 merged 4 commits into
mainfrom
windows/shortcuts-panel

Conversation

@tebriz91

@tebriz91 tebriz91 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

0.3.0 item 3 (ADR 0073).

What changes

  • One table, src/shortcuts.rs: every user-facing binding as a row (label, context group Everywhere / Editor / Popup / Panel), each binding with its action, key context, keys per platform (mod- = ⌘ or Ctrl) and the bind_keys that registers it. Every bind_keys registers its rows from there, so each module keeps its place in the keymap (GPUI breaks a tie between equally deep bindings by registration order). The mdoc_editor and gpui_pdf crates keep their own keymaps for their tests and other hosts; the app registers their rows from the table (shortcuts::bind_crate).
  • Plumbing stays put: Tab inside a control group, moving inside menus, choosers and the palette list, caret and deletion basics, the editor's own Esc, the OS character palette.
  • Palette: shortcut labels (and the sidebar's ⌘K / Home hints and Home's Open hint) come from the table; new action "Keyboard shortcuts". Pseudonymize now shows ⇧⌘P, which it was missing.
  • Sheet (src/workspace/shortcuts_ui.rs): read-only modal like the confirm dialog: filter field, rows grouped by context, this platform's keys only, list scrolls with arrows / Page Up/Down / Home / End, Tab stays inside, F6 blocked, Esc or click outside closes, focus returns. Opens with ? outside text fields, ⌘/ (Ctrl+/) everywhere (toggles), the palette, and Help → Keyboard Shortcuts on macOS.
  • Headless renders: new keyboard-shortcuts screen in light and dark.
  • main.rs::bind_all_keys is the one registration order, shared by launch and the headless renders.

Keymap unchanged

I dumped the full keymap before and after on Windows: the same 216 bindings plus the sheet's three (?, ctrl-/, Esc in the sheet). A few same-key pairs changed relative order inside pii, ui and shell; each is between contexts that never sit on the same element, so neither can win a tie. The ties that exist (Enter in the chooser, which is also PseudonymReview; Esc in the Replacements panel, which is also UiMenu) keep their order.

Tests

  • src/shortcuts/tests.rs: a bound action that's neither in the table nor named plumbing fails; a table row nothing registers fails; the editor and PDF crates' keymaps must match the table on both platforms. Checked that a stray ctrl-j binding fails it.
  • src/workspace/tests/shortcuts_sheet.rs: ? on Home opens it and every table row is drawn; ? types in the editor and the filter; ⌘/ toggles from the editor and focus returns; filter by word and by key; F6 stays inside; the palette opens it, and every key the palette shows is in the table.
  • Rebased Windows validation: just lint, just test, just fmt-check and git diff --check pass. Full workspace: 820 passed, 20 ignored, zero failures; includes 433 app tests, the isolated headless-render contract (light/dark shortcuts sheet), DOCX worker checks and release-script regressions. Native macOS/Windows keyboard, accessibility and presentation acceptance was not run in this takeover.

🤖 Generated with Claude Code

Codex review

Round 1 — gpt-6.1-sol, high

The first review reported three P2 findings; all were accepted and fixed in the review-fix commit:

  1. Commands could move focus behind the sheet. New could focus an obscured editor while the sheet stayed open. The sheet now closes when a command moves focus outside it, while switching apps keeps it open. Palette, Settings and Open Case are blocked while the sheet is open. Regression a_command_that_moves_focus_closes_the_sheet checks New, typing into the resulting editor, palette blocking and window deactivation.
  2. PDF and confirm-dialog shortcuts escaped the table and invariant. PDF Page Up/Down, Home/End and Go to Page, plus Discard in the save prompt, now use bound actions registered from the table. The crate-keymap invariant checks both platforms, and the sheet test draws every listed row.
  3. Comparison windows had no ShowShortcuts handler. App-level routing now activates the workspace and toggles its sheet. the_sheet_opens_from_another_window checks dispatch from another window; comparison-window availability includes ShowShortcuts. Native macOS Help-menu acceptance remains pending.

The minor missing changelog fragment is fixed by changes/shortcuts-panel.md. A separate render check found no focus ring on the filter; the filter now has an accent border while focused.

Integration and documentation

Rebased onto origin/main 6a6267f, preserving #201 restore wording, #202 save retry, #203 tab numbering and #205 fleet documentation. ROADMAP items 1, 2, 3 and 6 are absent. The former WIP is now a proper finishing commit: ADR 0073 is Accepted in ADR 0052 current-rules style, with the changelog fragment and acceptance row H23.

Round 2

Independent second round: provider codex, model gpt-6.1-sol, reasoningEffort: high, reviewing the rebased diff against origin/main and the earlier replies. One initial attempt failed at model capacity; the retry completed.

  • P2: Settings' restrictions could be bypassed by opening shortcuts over it. Reproduced Settings → Mod+/ → Mod+N → typing: New created a second tab behind visible Settings. Fixed by extracting Settings' existing document-command blockers into settings_ui::block_document_commands and applying the same helper to the shortcuts sheet while Settings is open. The regression shortcuts_over_settings_keep_document_commands_blocked failed before the fix (two tabs rather than one), then passed. It checks unchanged document text, no new tab, sheet focus retained, and focus returned inside the still-open Settings on Esc. ADR 0073 states this rule.
  • The review otherwise found the PDF/Discard fixes, cross-window routing, keymap registration order, theme-render coverage and documentation consistent, with Restore bar: say restored names are proposals and what Apply does #201–Number new untitled tabs #203/docs: Fleet section links the fleet skill for models and reviews #205 preserved.

This is static review plus Windows headless tests. Native macOS Help/keyboard and native accessibility/presentation acceptance remain unverified. Final validation at head 94fde9a: just lint, just test, just fmt-check and git diff --check pass. Workspace: 820 passed, 20 ignored, zero failures (433 app tests passed); isolated headless renders and release-script regressions passed. All four P2 findings across both rounds are fixed; no finding was deferred. Hosted checks for this pushed head are separate from these local results.

tebriz91 added a commit that referenced this pull request Oct 28, 2026
…ers PDF and dialog keys

From the Codex review of #204:

- A command that moves focus (New, Ctrl+Tab, Find) closes the sheet
  instead of acting behind it; the palette, Settings and Open Case, which
  would capture focus the closed sheet cannot give back, do nothing while
  it is open. Switching apps keeps it open.
- ShowShortcuts is also an app action, so Mod+/ and Help > Keyboard
  Shortcuts work from a model comparison window.
- The PDF view's Page Up / Down, Home, End and Go to Page (Cmd+Alt+G /
  Ctrl+Alt+G) are bound actions listed in the table rather than raw key
  handling; the confirm dialog's Discard (Cmd+D / Alt+D) likewise.
- The filter field shows the list's focus ring when it has focus (from the
  headless renders' Tab walk).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tebriz91 and others added 4 commits October 28, 2026 06:04
src/shortcuts.rs holds every user-facing key binding: label, context
group, keys per platform, and per binding the action, key context and the
bind_keys that registers it, so every module keeps its place in the keymap.
Each bind_keys, the editor and PDF crates' keymaps (through bind_crate),
the palette's shortcut labels and the sidebar and Home key hints read it.
Plumbing (Tab inside groups, menu and list moves, caret basics) stays in
its module.

The sheet is a read-only modal with a filter, grouped by context, this
platform's keys only; ? outside text fields, Mod+/ everywhere, the palette
and Help > Keyboard Shortcuts open it; Esc closes it. Headless renders
include it in both themes.

An invariant test fails on a bound action that is neither in the table nor
plumbing, on a table row nothing registers, or on a crate keymap that
disagrees with the table on either platform. The bound set is unchanged
apart from the sheet's three bindings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ers PDF and dialog keys

From the Codex review of #204:

- A command that moves focus (New, Ctrl+Tab, Find) closes the sheet
  instead of acting behind it; the palette, Settings and Open Case, which
  would capture focus the closed sheet cannot give back, do nothing while
  it is open. Switching apps keeps it open.
- ShowShortcuts is also an app action, so Mod+/ and Help > Keyboard
  Shortcuts work from a model comparison window.
- The PDF view's Page Up / Down, Home, End and Go to Page (Cmd+Alt+G /
  Ctrl+Alt+G) are bound actions listed in the table rather than raw key
  handling; the confirm dialog's Discard (Cmd+D / Alt+D) likewise.
- The filter field shows the list's focus ring when it has focus (from the
  headless renders' Tab walk).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tebriz91
tebriz91 force-pushed the windows/shortcuts-panel branch from 9752ace to 94fde9a Compare October 28, 2026 03:18
@tebriz91
tebriz91 marked this pull request as ready for review October 28, 2026 03:18
@tebriz91
tebriz91 merged commit b7c1d28 into main Oct 28, 2026
5 checks passed
@tebriz91
tebriz91 deleted the windows/shortcuts-panel branch October 28, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant