From 1269b5258097d75f4cb413a0612570a106e32426 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sun, 15 Feb 2026 14:42:22 -0800 Subject: [PATCH] change defailt for new termial --- KEYBINDINGS.md | 2 +- apps/server/src/keybindings.ts | 15 +++++++-------- apps/server/src/wsServer.test.ts | 12 ++++-------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/KEYBINDINGS.md b/KEYBINDINGS.md index eb5a9ecfd3c19cdee76c4e277d6cd98006d74497..e3be8baac540444f8581f49b3f4190e33b4086d5 100644 --- a/KEYBINDINGS.md +++ b/KEYBINDINGS.md @@ -21,7 +21,7 @@ See the full schema for more details: [`packages/contracts/src/keybindings.ts`]( [ { "key": "mod+j", "command": "terminal.toggle" }, { "key": "mod+d", "command": "terminal.split", "when": "terminalFocus" }, - { "key": "mod+shift+d", "command": "terminal.new", "when": "terminalFocus" }, + { "key": "mod+n", "command": "terminal.new", "when": "terminalFocus" }, { "key": "mod+shift+o", "command": "chat.new" }, { "key": "mod+o", "command": "editor.openFavorite" } ] diff --git a/apps/server/src/keybindings.ts b/apps/server/src/keybindings.ts index 3a92a4fed13922670c15023e95bb00570c8bcaaa..b9a0b4d7854f1b03b22b3c9e1eb65f51431d3222 100644 --- a/apps/server/src/keybindings.ts +++ b/apps/server/src/keybindings.ts @@ -27,7 +27,7 @@ type WhenToken = export const DEFAULT_KEYBINDINGS: ReadonlyArray = [ { key: "mod+j", command: "terminal.toggle" }, { key: "mod+d", command: "terminal.split", when: "terminalFocus" }, - { key: "mod+shift+d", command: "terminal.new", when: "terminalFocus" }, + { key: "mod+n", command: "terminal.new", when: "terminalFocus" }, { key: "mod+shift+o", command: "chat.new" }, { key: "mod+o", command: "editor.openFavorite" }, ]; @@ -39,7 +39,10 @@ function normalizeKeyToken(token: string): string { } export function parseKeybindingShortcut(value: string): KeybindingShortcut | null { - const rawTokens = value.toLowerCase().split("+").map((token) => token.trim()); + const rawTokens = value + .toLowerCase() + .split("+") + .map((token) => token.trim()); const tokens = [...rawTokens]; let trailingEmptyCount = 0; while (tokens[tokens.length - 1] === "") { @@ -220,9 +223,7 @@ export function parseKeybindingWhenExpression(expression: string): KeybindingWhe return ast; } -export function compileResolvedKeybindingRule( - rule: KeybindingRule, -): ResolvedKeybindingRule | null { +export function compileResolvedKeybindingRule(rule: KeybindingRule): ResolvedKeybindingRule | null { const key = rule.key.trim(); if (key.length === 0) return null; const shortcut = parseKeybindingShortcut(key); @@ -271,9 +272,7 @@ function compileDefaultKeybindings(): ResolvedKeybindingsConfig { const DEFAULT_RESOLVED_KEYBINDINGS = compileDefaultKeybindings(); -function mergeWithDefaultKeybindings( - custom: ResolvedKeybindingsConfig, -): ResolvedKeybindingsConfig { +function mergeWithDefaultKeybindings(custom: ResolvedKeybindingsConfig): ResolvedKeybindingsConfig { if (custom.length === 0) { return [...DEFAULT_RESOLVED_KEYBINDINGS]; } diff --git a/apps/server/src/wsServer.test.ts b/apps/server/src/wsServer.test.ts index 2d6418fdbf16f8ab1b2d037efa035d8f62cb9bfb..0c64f787730cffcafb58dea3558c62da7418a168 100644 --- a/apps/server/src/wsServer.test.ts +++ b/apps/server/src/wsServer.test.ts @@ -351,7 +351,7 @@ describe("WebSocket Server", () => { JSON.stringify([ { key: "cmd+j", command: "terminal.toggle" }, { key: "mod+d", command: "terminal.split", when: "terminalFocus" }, - { key: "mod+shift+d", command: "terminal.new", when: "terminalFocus" }, + { key: "mod+n", command: "terminal.new", when: "terminalFocus" }, ]), "utf8", ); @@ -374,7 +374,7 @@ describe("WebSocket Server", () => { keybindings: mergeWithDefaultsForTest([ { key: "cmd+j", command: "terminal.toggle" }, { key: "mod+d", command: "terminal.split", when: "terminalFocus" }, - { key: "mod+shift+d", command: "terminal.new", when: "terminalFocus" }, + { key: "mod+n", command: "terminal.new", when: "terminalFocus" }, ]), }); }); @@ -408,9 +408,7 @@ describe("WebSocket Server", () => { expect(response.error).toBeUndefined(); expect(response.result).toEqual({ cwd: "/my/workspace", - keybindings: mergeWithDefaultsForTest([ - { key: "mod+j", command: "terminal.toggle" }, - ]), + keybindings: mergeWithDefaultsForTest([{ key: "mod+j", command: "terminal.toggle" }]), }); expect( warnSpy.mock.calls.some(([message]) => @@ -479,9 +477,7 @@ describe("WebSocket Server", () => { expect(firstResponse.error).toBeUndefined(); expect(firstResponse.result).toEqual({ cwd: "/my/workspace", - keybindings: mergeWithDefaultsForTest([ - { key: "cmd+j", command: "terminal.toggle" }, - ]), + keybindings: mergeWithDefaultsForTest([{ key: "cmd+j", command: "terminal.toggle" }]), }); fs.writeFileSync( -- 2.54.0