MCPcopy
hub / github.com/go-rod/rod / AddKey

Function AddKey

lib/input/keyboard.go:29–48  ·  view source on GitHub ↗

AddKey to KeyMap.

(key string, shiftedKey string, code string, keyCode int, location int)

Source from the content-addressed store, hash-verified

27
28// AddKey to KeyMap.
29func AddKey(key string, shiftedKey string, code string, keyCode int, location int) Key {
30 if len(key) == 1 {
31 r := Key(key[0])
32 if _, has := keyMap[r]; !has {
33 keyMap[r] = KeyInfo{key, code, keyCode, location}
34
35 if len(shiftedKey) == 1 {
36 rs := Key(shiftedKey[0])
37 keyMapShifted[rs] = KeyInfo{shiftedKey, code, keyCode, location}
38 keyShiftedMap[r] = rs
39 }
40 return r
41 }
42 }
43
44 k := Key(keyCode + (location+1)*256)
45 keyMap[k] = KeyInfo{key, code, keyCode, location}
46
47 return k
48}
49
50// Info of the key.
51func (k Key) Info() KeyInfo {

Callers 1

keymap.goFile · 0.85

Calls 1

KeyTypeAlias · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…