authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-15 14:42:22-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-02-15 15:51:05-08:00
log1269b5258097d75f4cb413a0612570a106e32426
tree5d2f5d3734dd58e2766cdac7d57d80c83d1ee10c
parentfe79c8e9ee7471a6d32b9c045a19073c236809e6

change defailt for new termial


3 files changed, 12 insertions(+), 17 deletions(-)

KEYBINDINGS.md+1-1
......@@ -21,7 +21,7 @@ See the full schema for more details: [`packages/contracts/src/keybindings.ts`](
2121[
2222 { "key": "mod+j", "command": "terminal.toggle" },
2323 { "key": "mod+d", "command": "terminal.split", "when": "terminalFocus" },
24 { "key": "mod+shift+d", "command": "terminal.new", "when": "terminalFocus" },
24 { "key": "mod+n", "command": "terminal.new", "when": "terminalFocus" },
2525 { "key": "mod+shift+o", "command": "chat.new" },
2626 { "key": "mod+o", "command": "editor.openFavorite" }
2727]
apps/server/src/keybindings.ts+7-8
......@@ -27,7 +27,7 @@ type WhenToken =
2727export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
2828 { key: "mod+j", command: "terminal.toggle" },
2929 { key: "mod+d", command: "terminal.split", when: "terminalFocus" },
30 { key: "mod+shift+d", command: "terminal.new", when: "terminalFocus" },
30 { key: "mod+n", command: "terminal.new", when: "terminalFocus" },
3131 { key: "mod+shift+o", command: "chat.new" },
3232 { key: "mod+o", command: "editor.openFavorite" },
3333];
......@@ -39,7 +39,10 @@ function normalizeKeyToken(token: string): string {
3939}
4040
4141export function parseKeybindingShortcut(value: string): KeybindingShortcut | null {
42 const rawTokens = value.toLowerCase().split("+").map((token) => token.trim());
42 const rawTokens = value
43 .toLowerCase()
44 .split("+")
45 .map((token) => token.trim());
4346 const tokens = [...rawTokens];
4447 let trailingEmptyCount = 0;
4548 while (tokens[tokens.length - 1] === "") {
......@@ -220,9 +223,7 @@ export function parseKeybindingWhenExpression(expression: string): KeybindingWhe
220223 return ast;
221224}
222225
223export function compileResolvedKeybindingRule(
224 rule: KeybindingRule,
225): ResolvedKeybindingRule | null {
226export function compileResolvedKeybindingRule(rule: KeybindingRule): ResolvedKeybindingRule | null {
226227 const key = rule.key.trim();
227228 if (key.length === 0) return null;
228229 const shortcut = parseKeybindingShortcut(key);
......@@ -271,9 +272,7 @@ function compileDefaultKeybindings(): ResolvedKeybindingsConfig {
271272
272273const DEFAULT_RESOLVED_KEYBINDINGS = compileDefaultKeybindings();
273274
274function mergeWithDefaultKeybindings(
275 custom: ResolvedKeybindingsConfig,
276): ResolvedKeybindingsConfig {
275function mergeWithDefaultKeybindings(custom: ResolvedKeybindingsConfig): ResolvedKeybindingsConfig {
277276 if (custom.length === 0) {
278277 return [...DEFAULT_RESOLVED_KEYBINDINGS];
279278 }
apps/server/src/wsServer.test.ts+4-8
......@@ -351,7 +351,7 @@ describe("WebSocket Server", () => {
351351 JSON.stringify([
352352 { key: "cmd+j", command: "terminal.toggle" },
353353 { key: "mod+d", command: "terminal.split", when: "terminalFocus" },
354 { key: "mod+shift+d", command: "terminal.new", when: "terminalFocus" },
354 { key: "mod+n", command: "terminal.new", when: "terminalFocus" },
355355 ]),
356356 "utf8",
357357 );
......@@ -374,7 +374,7 @@ describe("WebSocket Server", () => {
374374 keybindings: mergeWithDefaultsForTest([
375375 { key: "cmd+j", command: "terminal.toggle" },
376376 { key: "mod+d", command: "terminal.split", when: "terminalFocus" },
377 { key: "mod+shift+d", command: "terminal.new", when: "terminalFocus" },
377 { key: "mod+n", command: "terminal.new", when: "terminalFocus" },
378378 ]),
379379 });
380380 });
......@@ -408,9 +408,7 @@ describe("WebSocket Server", () => {
408408 expect(response.error).toBeUndefined();
409409 expect(response.result).toEqual({
410410 cwd: "/my/workspace",
411 keybindings: mergeWithDefaultsForTest([
412 { key: "mod+j", command: "terminal.toggle" },
413 ]),
411 keybindings: mergeWithDefaultsForTest([{ key: "mod+j", command: "terminal.toggle" }]),
414412 });
415413 expect(
416414 warnSpy.mock.calls.some(([message]) =>
......@@ -479,9 +477,7 @@ describe("WebSocket Server", () => {
479477 expect(firstResponse.error).toBeUndefined();
480478 expect(firstResponse.result).toEqual({
481479 cwd: "/my/workspace",
482 keybindings: mergeWithDefaultsForTest([
483 { key: "cmd+j", command: "terminal.toggle" },
484 ]),
480 keybindings: mergeWithDefaultsForTest([{ key: "cmd+j", command: "terminal.toggle" }]),
485481 });
486482
487483 fs.writeFileSync(