From c3bf1c409f47d180547d5cbaaeed6514833c2dfe Mon Sep 17 00:00:00 2001 From: Northword Date: Tue, 21 Jul 2026 20:14:12 +0800 Subject: [PATCH] fix(keyboard): KeyModifier string parser no longer strips hyphen from key The regex in the string constructor was intended for hyphen-separated input formats (e.g. Ctrl-Shift-B), but the canonical format used throughout KeyModifier is comma-separated (from getRaw()). Stripping hyphens breaks legitimate key characters in raw strings such as accel,-. Remove hyphen from the separator character class. The comma key is still handled by the existing fallback. --- src/managers/keyboard.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/managers/keyboard.ts b/src/managers/keyboard.ts index 9ab30fa..2d93065 100644 --- a/src/managers/keyboard.ts +++ b/src/managers/keyboard.ts @@ -187,9 +187,9 @@ export class KeyModifier implements KeyModifierStatus { this.control = raw.includes("control"); this.meta = raw.includes("meta"); this.alt = raw.includes("alt"); - // Remove all modifiers, space, comma, and dash + // Remove all modifiers, space, and comma this.key = raw - .replace(/(accel|shift|control|meta|alt|[ ,\-])/g, "") + .replace(/(accel|shift|control|meta|alt|[ ,])/g, "") .toLocaleLowerCase(); if (!this.key && (raw.includes(",,") || raw === ",")) { // If there are two consecutive commas, it means the key is a comma