@@ -35,6 +35,14 @@ Key.prototype = {
35
35
// const isAlphaNumericKey = function(keyCode) {
36
36
// return isAlphabetKey(keyCode) || isNumericKey(keyCode);
37
37
// }
38
+
39
+ // CharMap --------------------------------------------------------------------
40
+ /*
41
+ CharMap Keys are pair-strings that are related to each other for the editor.
42
+ For example:
43
+ all enclosing literals are handled diffrently by the editor:
44
+ [], {}, (), '', ""
45
+ */
38
46
const isCharMapKey = function ( char ) {
39
47
return charMap [ char ] !== undefined ;
40
48
}
@@ -50,10 +58,27 @@ const isCharMapValue = function(char) {
50
58
const getCharMapValue = function ( char ) {
51
59
return charMap [ char ] ;
52
60
}
61
+
62
+ /*
63
+ Ignore Keys are keys that need not be handled by the editor.
64
+ More like "do nothing when these keys are pressed".
65
+
66
+ @param {keyCode } code of keyboard key
67
+ @return {boolean } true if it is a "IGNORE KEY", otherwise false
68
+ */
53
69
const isIgnoreKey = function ( keyCode ) {
54
70
return ignoreKeyList . includes ( keyCode ) ;
55
71
}
56
72
73
+ /*
74
+ keyToChar accepts keyCode of key on keyboard and
75
+ returns the expected character.
76
+ It also handles shift and capslock keys.
77
+ // TODO handle alt key
78
+
79
+ @param {keyCode } code of keyboard key
80
+ @return expected character mapped to the keyboard
81
+ */
57
82
const keyToChar = function ( keyCode ) {
58
83
let char ;
59
84
if ( shiftKey . isPressed ( ) || capsLockKey . isPressed ( ) ) {
0 commit comments