Skip to content

Commit 2b69b5f

Browse files
author
Steven Silvester
authored
Merge pull request #252 from PlatinumCD/master
Add arrow glyphs #151
2 parents 82e45aa + 57a6ee7 commit 2b69b5f

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

packages/commands/src/index.ts

+55-1
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,26 @@ export namespace CommandRegistry {
10621062
*/
10631063
shift: boolean;
10641064

1065+
/**
1066+
* Whether `'ArrowLeft'` appears in the keystroke.
1067+
*/
1068+
arrowLeft: boolean;
1069+
1070+
/**
1071+
* Whether `'ArrowUp'` appears in the keystroke.
1072+
*/
1073+
arrowUp: boolean;
1074+
1075+
/**
1076+
* Whether `'ArrowRight'` appears in the keystroke.
1077+
*/
1078+
arrowRight: boolean;
1079+
1080+
/**
1081+
* Whether `'ArrowDown'` appears in the keystroke.
1082+
*/
1083+
arrowDown: boolean;
1084+
10651085
/**
10661086
* The primary key for the keystroke.
10671087
*/
@@ -1096,6 +1116,10 @@ export namespace CommandRegistry {
10961116
let cmd = false;
10971117
let ctrl = false;
10981118
let shift = false;
1119+
let arrowLeft = false;
1120+
let arrowUp = false;
1121+
let arrowRight = false;
1122+
let arrowDown = false;
10991123
for (let token of keystroke.split(/\s+/)) {
11001124
if (token === 'Accel') {
11011125
if (Platform.IS_MAC) {
@@ -1111,11 +1135,29 @@ export namespace CommandRegistry {
11111135
ctrl = true;
11121136
} else if (token === 'Shift') {
11131137
shift = true;
1138+
} else if (token === 'ArrowLeft') {
1139+
arrowLeft = true;
1140+
} else if (token === 'ArrowUp') {
1141+
arrowUp = true;
1142+
} else if (token === 'ArrowRight') {
1143+
arrowRight = true;
1144+
} else if (token === 'ArrowDown') {
1145+
arrowDown = true;
11141146
} else if (token.length > 0) {
11151147
key = token;
11161148
}
11171149
}
1118-
return { cmd, ctrl, alt, shift, key };
1150+
return {
1151+
cmd,
1152+
ctrl,
1153+
alt,
1154+
shift,
1155+
key,
1156+
arrowLeft,
1157+
arrowUp,
1158+
arrowRight,
1159+
arrowDown
1160+
};
11191161
}
11201162

11211163
/**
@@ -1187,6 +1229,18 @@ export namespace CommandRegistry {
11871229
if (parts.cmd) {
11881230
mods += '\u2318 ';
11891231
}
1232+
if (parts.arrowLeft) {
1233+
mods += '\u2190 ';
1234+
}
1235+
if (parts.arrowUp) {
1236+
mods += '\u2191 ';
1237+
}
1238+
if (parts.arrowRight) {
1239+
mods += '\u2192 ';
1240+
}
1241+
if (parts.arrowDown) {
1242+
mods += '\u2193 ';
1243+
}
11901244
} else {
11911245
if (parts.ctrl) {
11921246
mods += 'Ctrl+';

0 commit comments

Comments
 (0)