Skip to content

Commit

Permalink
Add keypad values in keyToCharacterMapping
Browse files Browse the repository at this point in the history
using Unicode COMBINING ENCLOSING KEYCAP

(cherry picked from commit 4cdf170)
  • Loading branch information
soundflix committed Apr 10, 2023
1 parent d168f62 commit 1e59746
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion Sources/KeyboardShortcuts/Shortcut.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,30 @@ private var keyToCharacterMapping: [KeyboardShortcuts.Key: String] = [
.f17: "F17",
.f18: "F18",
.f19: "F19",
.f20: "F20"
.f20: "F20",

Check warning on line 189 in Sources/KeyboardShortcuts/Shortcut.swift

View workflow job for this annotation

GitHub Actions / lint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
// Representations for numeric keypad keys with ⃣ Unicode U+20e3 'COMBINING ENCLOSING KEYCAP'
.keypad0: "0\u{20e3}",
.keypad1: "1\u{20e3}",
.keypad2: "2\u{20e3}",
.keypad3: "3\u{20e3}",
.keypad4: "4\u{20e3}",
.keypad5: "5\u{20e3}",
.keypad6: "6\u{20e3}",
.keypad7: "7\u{20e3}",
.keypad8: "8\u{20e3}",
.keypad9: "9\u{20e3}",
// There's "⌧“ 'X In A Rectangle Box' (U+2327), "☒" 'Ballot Box with X' (U+2612), "×" 'Multiplication Sign' (U+00d7), "⨯" 'Vector or Cross Product' (U+2a2f), or a plain small x. All combined symbols appear bigger.
.keypadClear: "\u{20e3}", // The combined symbol appears bigger than the other combined 'keycaps'
// TODO: Respect locale decimal separator ("." or ",")
.keypadDecimal: ".\u{20e3}",
.keypadDivide: "/\u{20e3}",
// "⏎" 'Return Symbol' (U+23CE) but "↩" 'Leftwards Arrow with Hook' (U+00d7) seems to be more common on macOS.
.keypadEnter: "\u{20e3}", // The combined symbol appears bigger than the other combined 'keycaps'
.keypadEquals: "=\u{20e3}",
.keypadMinus: "-\u{20e3}",
.keypadMultiply: "*\u{20e3}",
.keypadPlus: "+\u{20e3}"
]

private func stringFromKeyCode(_ keyCode: Int) -> String {
Expand Down

0 comments on commit 1e59746

Please sign in to comment.