Browse Source

fix: display arrow keys as symbols in keybind formatting

David Hill 1 month ago
parent
commit
69215d456c
1 changed files with 9 additions and 1 deletions
  1. 9 1
      packages/app/src/context/command.tsx

+ 9 - 1
packages/app/src/context/command.tsx

@@ -104,7 +104,15 @@ export function formatKeybind(config: string): string {
   if (kb.meta) parts.push(IS_MAC ? "⌘" : "Meta")
 
   if (kb.key) {
-    const displayKey = kb.key.length === 1 ? kb.key.toUpperCase() : kb.key.charAt(0).toUpperCase() + kb.key.slice(1)
+    const arrows: Record<string, string> = {
+      arrowup: "↑",
+      arrowdown: "↓",
+      arrowleft: "←",
+      arrowright: "→",
+    }
+    const displayKey =
+      arrows[kb.key.toLowerCase()] ??
+      (kb.key.length === 1 ? kb.key.toUpperCase() : kb.key.charAt(0).toUpperCase() + kb.key.slice(1))
     parts.push(displayKey)
   }