forked from c-bata/go-prompt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
key.go
128 lines (112 loc) · 1.71 KB
/
key.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Code generated by hand; DO NOT EDIT.
// This is a little bit stupid, but there are many public constants which is no value for writing godoc comment.
package prompt
// Key is the type express the key inserted from user.
//go:generate stringer -type=Key
type Key int
// ASCIICode is the type contains Key and it's ascii byte array.
type ASCIICode struct {
Key Key
ASCIICode []byte
}
const (
Escape Key = iota
ControlA
ControlB
ControlC
ControlD
ControlE
ControlF
ControlG
ControlH
ControlI
ControlJ
ControlK
ControlL
ControlM
ControlN
ControlO
ControlP
ControlQ
ControlR
ControlS
ControlT
ControlU
ControlV
ControlW
ControlX
ControlY
ControlZ
ControlSpace
ControlBackslash
ControlSquareClose
ControlCircumflex
ControlUnderscore
ControlLeft
ControlRight
ControlUp
ControlDown
Up
Down
Right
Left
ShiftLeft
ShiftUp
ShiftDown
ShiftRight
Home
End
Delete
ShiftDelete
ControlDelete
PageUp
PageDown
BackTab
Insert
Backspace
// Aliases.
Tab
Enter
// Actually Enter equals ControlM, not ControlJ,
// However, in prompt_toolkit, we made the mistake of translating
// \r into \n during the input, so everyone is now handling the
// enter key by binding ControlJ.
// From now on, it's better to bind `ASCII_SEQUENCES.Enter` everywhere,
// because that's future compatible, and will still work when we
// stop replacing \r by \n.
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
// Matches any key.
Any
// Special
CPRResponse
Vt100MouseEvent
WindowsMouseEvent
BracketedPaste
// Key which is ignored. (The key binding for this key should not do anything.)
Ignore
// Key is not defined
NotDefined
)