M4.2: Lutra-own shortcuts for the Changes window

vcs.commit moves from Mod+K (the public default keymap's Commit) to
Mod+Alt+Shift+M, and vcs.openChanges from Mod+Alt+G (CodeMirror's go to
line in basicSetup, which the global listener would swallow) to
Mod+Alt+Shift+G. Both were checked against the public Windows and macOS
default keymap pages, Lutra's registered shortcuts and CodeMirror's keys.
Tests and docs follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-25 17:35:39 +01:00
parent f67f6b9f7c
commit eb7e6376b7
8 changed files with 14 additions and 13 deletions

View file

@ -35,8 +35,8 @@ export const UI_COMMANDS: readonly UiCommandSpec[] = [
{ id: "settings.open", labelKey: "command.settings.open", menuPath: "View/Settings…", defaultShortcut: "Mod+," },
{ id: "terminal.open", labelKey: "command.terminal.open", menuPath: "View/Terminal", defaultShortcut: "Mod+Shift+T" },
{ id: "view.toggleProjectTree", labelKey: "command.view.toggleProjectTree", menuPath: "View/Project", defaultShortcut: "Mod+1" },
{ id: "vcs.commit", labelKey: "command.vcs.commit", menuPath: "Git/Commit…", defaultShortcut: "Mod+K" },
{ id: "vcs.openChanges", labelKey: "command.vcs.openChanges", menuPath: "Git/Changes", defaultShortcut: "Mod+Alt+G" },
{ id: "vcs.commit", labelKey: "command.vcs.commit", menuPath: "Git/Commit…", defaultShortcut: "Mod+Alt+Shift+M" },
{ id: "vcs.openChanges", labelKey: "command.vcs.openChanges", menuPath: "Git/Changes", defaultShortcut: "Mod+Alt+Shift+G" },
{ id: "vcs.refresh", labelKey: "command.vcs.refresh", menuPath: "Git/Refresh Changes" },
{ id: "view.toggleStructure", labelKey: "command.view.toggleStructure", menuPath: "View/Structure", defaultShortcut: "Mod+2" },
];

View file

@ -27,9 +27,10 @@
* the diagnostics while they are hidden. The References tab (M3.5) shows
* when Find References runs (`lsp.references`); the nav store keeps its
* results. The Changes tab (M4.2) appears with `vcs.openChanges`
* (`Mod+Alt+G`) and `vcs.commit` (`Mod+K`, which also focuses the commit
* message box); `vcs.refresh` re-reads the Git status. Its store reads the
* status from the start, so it is current when the tab opens.
* (`Mod+Alt+Shift+G`) and `vcs.commit` (`Mod+Alt+Shift+M`, which also
* focuses the commit message box); `vcs.refresh` re-reads the Git status.
* Its store reads the status from the start, so it is current when the
* tab opens.
*
* A slim header bar along the top (M3.9) holds the app menu
* ({@link AppMenu}); its `header` slot can replace it.

View file

@ -420,15 +420,15 @@ describe("the vcs commands in the main layout", () => {
defaultShortcut?: string;
menuPath?: string;
}[];
expect(registered.find((c) => c.id === "vcs.openChanges")).toMatchObject({ defaultShortcut: "Mod+Alt+G", menuPath: "Git/Changes" });
expect(registered.find((c) => c.id === "vcs.commit")).toMatchObject({ defaultShortcut: "Mod+K", menuPath: "Git/Commit…" });
expect(registered.find((c) => c.id === "vcs.openChanges")).toMatchObject({ defaultShortcut: "Mod+Alt+Shift+G", menuPath: "Git/Changes" });
expect(registered.find((c) => c.id === "vcs.commit")).toMatchObject({ defaultShortcut: "Mod+Alt+Shift+M", menuPath: "Git/Commit…" });
expect(registered.find((c) => c.id === "vcs.refresh")?.menuPath).toBe("Git/Refresh Changes");
});
it("opens the tab with its shortcut, focuses the box with vcs.commit and refreshes", async () => {
const wrapper = await mountLayout();
expect(wrapper.find("[data-test=changes]").exists()).toBe(false);
window.dispatchEvent(new KeyboardEvent("keydown", { key: "g", code: "KeyG", ctrlKey: true, altKey: true, bubbles: true }));
window.dispatchEvent(new KeyboardEvent("keydown", { key: "G", code: "KeyG", ctrlKey: true, altKey: true, shiftKey: true, bubbles: true }));
await flushPromises();
expect(wrapper.get("[data-test=changes]").isVisible()).toBe(true);
const commands = useCommandsStore(pinia);