From f6b3978090a888d4b4a2d429baaba222c6b40721 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 23 Nov 2026 04:41:02 +0000 Subject: [PATCH 1/3] test(server): trailing-plus keybinding typos are reported as invalid entries Failing repro for #41225. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/keybindings.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/server/src/keybindings.test.ts b/apps/server/src/keybindings.test.ts index 7e846811e1440..70b62fc697068 100644 --- a/apps/server/src/keybindings.test.ts +++ b/apps/server/src/keybindings.test.ts @@ -182,6 +182,8 @@ it.layer(NodeServices.layer)("keybindings", (it) => { { key: "mod+j", command: "terminal.toggle" }, { key: "mod+shift+d+o", command: "terminal.new" }, { key: "mod+x", command: "invalid.command" }, + { key: "mod+", command: "sidebar.toggle" }, + { key: "mod+++", command: "sidebar.toggle" }, ]), ); @@ -205,6 +207,16 @@ it.layer(NodeServices.layer)("keybindings", (it) => { index: 2, message: configState.issues[1]?.message ?? "", }, + { + kind: "keybindings.invalid-entry", + index: 3, + message: configState.issues[2]?.message ?? "", + }, + { + kind: "keybindings.invalid-entry", + index: 4, + message: configState.issues[3]?.message ?? "", + }, ]); }).pipe(Effect.provide(layerKeybindings())), ); From 05377bb1f0e17bda7fa33d9e747dd13279a90551 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 23 Nov 2026 04:44:37 +0000 Subject: [PATCH 2/3] fix(shared): reject keybindings with a dangling or extra '+' parseKeybindingShortcut treated any number of trailing empty tokens as the '+' key, so typos like "mod+", "ctrl+shift+" and "mod+++" compiled to a plus-key shortcut and replaced the command's default. Only exactly two trailing empty tokens ("+", "++") now mean the plus key. Fixes #41225 Co-Authored-By: Claude Opus 5.5 --- packages/shared/src/keybindings.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/keybindings.ts b/packages/shared/src/keybindings.ts index 9a67264d8bd1f..aacd7649ed8cd 100644 --- a/packages/shared/src/keybindings.ts +++ b/packages/shared/src/keybindings.ts @@ -167,7 +167,7 @@ export function parseKeybindingShortcut(value: string): KeybindingShortcut | nul trailingEmptyCount += 1; tokens.pop(); } - if (trailingEmptyCount > 0) { + if (trailingEmptyCount === 2) { tokens.push("+"); } if (tokens.some((token) => token.length === 0)) { From f91109d803a5aa2aa9fcd62b86ea15552fcf51ce Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 23 Nov 2026 04:51:56 +0000 Subject: [PATCH 3/3] fix(shared): reject trailing '+' typos that follow a key Stripping one or three trailing empty tokens left "mod+a+" and "mod+a+++" parsing as mod+a. Any trailing count other than 0 or 2 is now rejected. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/keybindings.test.ts | 2 +- packages/shared/src/keybindings.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/server/src/keybindings.test.ts b/apps/server/src/keybindings.test.ts index 70b62fc697068..44048330c3ae2 100644 --- a/apps/server/src/keybindings.test.ts +++ b/apps/server/src/keybindings.test.ts @@ -183,7 +183,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => { { key: "mod+shift+d+o", command: "terminal.new" }, { key: "mod+x", command: "invalid.command" }, { key: "mod+", command: "sidebar.toggle" }, - { key: "mod+++", command: "sidebar.toggle" }, + { key: "mod+a+++", command: "sidebar.toggle" }, ]), ); diff --git a/packages/shared/src/keybindings.ts b/packages/shared/src/keybindings.ts index aacd7649ed8cd..29bb71d5f6f1a 100644 --- a/packages/shared/src/keybindings.ts +++ b/packages/shared/src/keybindings.ts @@ -169,6 +169,8 @@ export function parseKeybindingShortcut(value: string): KeybindingShortcut | nul } if (trailingEmptyCount === 2) { tokens.push("+"); + } else if (trailingEmptyCount !== 0) { + return null; } if (tokens.some((token) => token.length === 0)) { return null;