Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/server/src/keybindings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
assert.equal(defaultsByCommand.get("projectSearch.toggle"), "mod+shift+f");
assert.equal(defaultsByCommand.get("sidebar.toggle"), "mod+b");
assert.equal(defaultsByCommand.get("rightPanel.toggle"), "mod+alt+b");
assert.isFalse(defaultsByCommand.has("rightPanel.toggleMaximized"));
assert.equal(defaultsByCommand.get("terminal.splitVertical"), "mod+shift+d");
assert.equal(defaultsByCommand.get("modelPicker.jump.1"), "mod+1");
assert.equal(defaultsByCommand.get("modelPicker.jump.9"), "mod+9");
Expand Down
8 changes: 8 additions & 0 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4739,6 +4739,13 @@ function ChatViewContent(props: ChatViewProps) {
return;
}

if (command === "rightPanel.toggleMaximized") {
event.preventDefault();
event.stopPropagation();
toggleRightPanelMaximized();
return;
}

if (command === "terminal.split") {
event.preventDefault();
event.stopPropagation();
Expand Down Expand Up @@ -4834,6 +4841,7 @@ function ChatViewContent(props: ChatViewProps) {
keybindings,
onToggleDiff,
toggleRightPanel,
toggleRightPanelMaximized,
toggleTerminalVisibility,
composerRef,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe("KeybindingsSettings.logic", () => {
expect(options).not.toContain("customModeActive");
});

it("builds command options from defaults and resolved project bindings", () => {
it("builds command options from built-in commands and resolved project bindings", () => {
const options = buildKeybindingCommandOptions([
{
command: "script.setup-db.run",
Expand All @@ -150,7 +150,9 @@ describe("KeybindingsSettings.logic", () => {
},
] satisfies ResolvedKeybindingsConfig);

expect(options).toEqual(expect.arrayContaining(["chat.new", "script.setup-db.run"]));
expect(options).toEqual(
expect.arrayContaining(["chat.new", "rightPanel.toggleMaximized", "script.setup-db.run"]),
);
});

it("reports unknown when variables without rejecting parseable expressions", () => {
Expand Down
6 changes: 2 additions & 4 deletions apps/web/src/components/settings/KeybindingsSettings.logic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
STATIC_KEYBINDING_COMMANDS,
type KeybindingCommand,
type KeybindingShortcut,
type KeybindingWhenNode,
Expand Down Expand Up @@ -255,10 +256,7 @@ export function buildWhenVariableOptions(): ReadonlyArray<WhenVariableOption> {
export function buildKeybindingCommandOptions(
keybindings: ResolvedKeybindingsConfig,
): ReadonlyArray<KeybindingCommandOption> {
const commands = new Set<KeybindingCommand>();
for (const binding of DEFAULT_RESOLVED_KEYBINDINGS) {
commands.add(binding.command);
}
const commands = new Set<KeybindingCommand>(STATIC_KEYBINDING_COMMANDS);
for (const binding of keybindings) {
commands.add(binding.command);
}
Expand Down
16 changes: 16 additions & 0 deletions apps/web/src/keybindings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,22 @@ describe("resolveShortcutCommand", () => {
);
});

it("resolves a custom right panel maximize binding", () => {
const keybindings = compile([
{
shortcut: modShortcut("m", { shiftKey: true }),
command: "rightPanel.toggleMaximized",
},
]);

assert.strictEqual(
resolveShortcutCommand(event({ key: "m", metaKey: true, shiftKey: true }), keybindings, {
platform: "MacIntel",
}),
"rightPanel.toggleMaximized",
);
});

it("matches bracket shortcuts using the physical key code", () => {
assert.strictEqual(
resolveShortcutCommand(
Expand Down
3 changes: 3 additions & 0 deletions docs/user/keybindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Use **Inspect** to pick an element in the app and reveal its color token. Inspec
successful pick; its hover glow and badge preview the element and token that click will select.
**Cancel** or `Escape` exits Inspect and clears its selection and spotlight.

`rightPanel.toggleMaximized` maximizes or restores the open right panel. It has no default shortcut,
so add one in **Settings** → **Keybindings** if you want to use it.

The command palette searches active thread titles, projects, branches, user messages, and final
agent responses across connected environments. Message matches show one labeled excerpt while
keeping the thread's project, branch, and machine context visible. Message search begins after two
Expand Down
6 changes: 6 additions & 0 deletions packages/contracts/src/keybindings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ it.effect("parses keybinding rules", () =>
});
assert.strictEqual(parsedRightPanelToggle.command, "rightPanel.toggle");

const parsedRightPanelToggleMaximized = yield* decode(KeybindingRule, {
key: "mod+shift+m",
command: "rightPanel.toggleMaximized",
});
assert.strictEqual(parsedRightPanelToggleMaximized.command, "rightPanel.toggleMaximized");

const parsedClose = yield* decode(KeybindingRule, {
key: "mod+w",
command: "terminal.close",
Expand Down
3 changes: 2 additions & 1 deletion packages/contracts/src/keybindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ export const MODEL_PICKER_KEYBINDING_COMMANDS = [
] as const;
export type ModelPickerKeybindingCommand = (typeof MODEL_PICKER_KEYBINDING_COMMANDS)[number];

const STATIC_KEYBINDING_COMMANDS = [
export const STATIC_KEYBINDING_COMMANDS = [
"sidebar.toggle",
"terminal.toggle",
"terminal.split",
"terminal.splitVertical",
"terminal.new",
"terminal.close",
"rightPanel.toggle",
"rightPanel.toggleMaximized",
"diff.toggle",
"preview.toggle",
"preview.refresh",
Expand Down
Loading