Skip to content

Commit 77147cf

Browse files
committed
fix: update shortcuts shown in dialog
1 parent 4587aa5 commit 77147cf

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/constants.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export enum SHORTCUT_NAMES {
3535
LEFT = 'left',
3636
NEXT_STACK = 'next_stack',
3737
PREVIOUS_STACK = 'previous_stack',
38+
// Unused.
3839
INSERT = 'insert',
3940
EDIT_OR_CONFIRM = 'edit_or_confirm',
4041
DISCONNECT = 'disconnect',
@@ -52,8 +53,16 @@ export enum SHORTCUT_NAMES {
5253
CREATE_WS_CURSOR = 'to_workspace',
5354
LIST_SHORTCUTS = 'list_shortcuts',
5455
CLEAN_UP = 'clean_up_workspace',
56+
START_MOVE = 'start_move',
5557
}
5658

59+
export const SHORTCUT_NAMES_TO_DISPLAY_TEXT: Record<string, string> = {
60+
'keyboard_nav_copy': Msg['Copy'] || 'Copy',
61+
'keyboard_nav_cut': Msg['Cut'] || 'Cut',
62+
'keyboard_nav_paste': Msg['Paste'] || 'Paste',
63+
'start_move': Msg['MOVE_BLOCK'] || 'Move',
64+
};
65+
5766
/**
5867
* Types of possible messages passed into the loggingCallback in the Navigation
5968
* class.
@@ -73,7 +82,7 @@ export const SHORTCUT_CATEGORIES: Record<
7382
// Also allow undo/redo. Document the non-keyboard-nav versions of others for
7483
// better text because temporarily the name in the table is derived from
7584
// these id-like names.
76-
Array<SHORTCUT_NAMES | 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'delete'>
85+
Array<SHORTCUT_NAMES | 'undo' | 'redo' | 'delete'>
7786
> = {};
7887

7988
SHORTCUT_CATEGORIES[Msg['SHORTCUTS_GENERAL']] = [
@@ -86,12 +95,12 @@ SHORTCUT_CATEGORIES[Msg['SHORTCUTS_GENERAL']] = [
8695
];
8796

8897
SHORTCUT_CATEGORIES[Msg['SHORTCUTS_EDITING']] = [
89-
SHORTCUT_NAMES.INSERT,
9098
'delete',
9199
SHORTCUT_NAMES.DISCONNECT,
92-
'cut',
93-
'copy',
94-
'paste',
100+
SHORTCUT_NAMES.START_MOVE,
101+
SHORTCUT_NAMES.CUT,
102+
SHORTCUT_NAMES.COPY,
103+
SHORTCUT_NAMES.PASTE,
95104
SHORTCUT_NAMES.DUPLICATE,
96105
'undo',
97106
'redo',
@@ -104,4 +113,5 @@ SHORTCUT_CATEGORIES[Msg['SHORTCUTS_CODE_NAVIGATION']] = [
104113
SHORTCUT_NAMES.LEFT,
105114
SHORTCUT_NAMES.NEXT_STACK,
106115
SHORTCUT_NAMES.PREVIOUS_STACK,
116+
SHORTCUT_NAMES.CREATE_WS_CURSOR,
107117
];

src/shortcut_dialog.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ export class ShortcutDialog {
8888
* @returns A title case version of the name.
8989
*/
9090
getReadableShortcutName(shortcutName: string) {
91+
if (Constants.SHORTCUT_NAMES_TO_DISPLAY_TEXT[shortcutName]) {
92+
return Constants.SHORTCUT_NAMES_TO_DISPLAY_TEXT[shortcutName];
93+
}
9194
return upperCaseFirst(shortcutName.replace(/_/gi, ' '));
9295
}
9396

0 commit comments

Comments
 (0)