"Fix" getStringForKeyCode returning incorrect strings (#753)

* Fix getStringForKeyCode returning wrong result

This adds the full stop/period (.) key to the switch statement, and replaces String.fromCharCode (which works with Unicode) with the replacement character (�).

* Make letter keys work properly

* Add digits and display unknown codes in brackets

* better formatting
pull/760/head
EmeraldBlock 4 years ago committed by GitHub
parent 7517d4a979
commit 0481c84e72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -248,6 +248,8 @@ export function getStringForKeyCode(code) {
return ","; return ",";
case 189: case 189:
return "-"; return "-";
case 190:
return ".";
case 191: case 191:
return "/"; return "/";
case 219: case 219:
@ -260,7 +262,9 @@ export function getStringForKeyCode(code) {
return "'"; return "'";
} }
return String.fromCharCode(code); return (48 <= code && code <= 57) || (65 <= code && code <= 90)
? String.fromCharCode(code)
: "[" + code + "]";
} }
export class Keybinding { export class Keybinding {

Loading…
Cancel
Save