diff --git a/apps/server/src/keybindings.test.ts b/apps/server/src/keybindings.test.ts index 7e846811e1440..44048330c3ae2 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+a+++", 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())), ); diff --git a/packages/shared/src/keybindings.ts b/packages/shared/src/keybindings.ts index 9a67264d8bd1f..29bb71d5f6f1a 100644 --- a/packages/shared/src/keybindings.ts +++ b/packages/shared/src/keybindings.ts @@ -167,8 +167,10 @@ export function parseKeybindingShortcut(value: string): KeybindingShortcut | nul trailingEmptyCount += 1; tokens.pop(); } - if (trailingEmptyCount > 0) { + if (trailingEmptyCount === 2) { tokens.push("+"); + } else if (trailingEmptyCount !== 0) { + return null; } if (tokens.some((token) => token.length === 0)) { return null;