Skip to content

Commit

Permalink
Use Space for a space key instead of
Browse files Browse the repository at this point in the history
Fixes #141
  • Loading branch information
sindresorhus committed Aug 15, 2023
1 parent 8b1a9ce commit 43bedc9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/KeyboardShortcuts/Shortcut.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private var keyToCharacterMapping: [KeyboardShortcuts.Key: String] = [
.escape: "",
.help: "?⃝",
.home: "",
.space: "",
.space: "Space", // This matches what macOS uses.
.tab: "",
.pageUp: "",
.pageDown: "",
Expand Down Expand Up @@ -320,6 +320,7 @@ extension KeyboardShortcuts.Shortcut: CustomStringConvertible {
```
*/
public var description: String {
modifiers.description + (keyToCharacter()?.uppercased() ?? "")
// We use `.capitalized` so it correctly handles “⌘Space”.
modifiers.description + (keyToCharacter()?.capitalized ?? "")
}
}

0 comments on commit 43bedc9

Please sign in to comment.