MCPcopy Create free account
hub / github.com/philc/vimium / getKeyCharString

Function getKeyCharString

lib/keyboard_utils.js:76–96  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

74 },
75
76 getKeyCharString(event) {
77 let keyChar = this.getKeyChar(event);
78 if (!keyChar) {
79 return;
80 }
81
82 const modifiers = [];
83
84 if (event.shiftKey && (keyChar.length === 1)) keyChar = keyChar.toUpperCase();
85 // These must be in alphabetical order (to match the sorted modifier order in
86 // Commands.normalizeKey).
87 if (event.altKey) modifiers.push("a");
88 if (event.ctrlKey) modifiers.push("c");
89 if (event.metaKey) modifiers.push("m");
90 if (event.shiftKey && (keyChar.length > 1)) modifiers.push("s");
91
92 keyChar = [...modifiers, keyChar].join("-");
93 if (1 < keyChar.length) keyChar = `<${keyChar}>`;
94 keyChar = mapKeyRegistry[keyChar] != null ? mapKeyRegistry[keyChar] : keyChar;
95 return keyChar;
96 },
97
98 isEscape: (function () {
99 let useVimLikeEscape = true;

Callers

nothing calls this directly

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected