...
1 package prompt
2
3
4 type KeyBindFunc func(*Buffer)
5
6
7 type KeyBind struct {
8 Key Key
9 Fn KeyBindFunc
10 }
11
12
13 type ASCIICodeBind struct {
14 ASCIICode []byte
15 Fn KeyBindFunc
16 }
17
18
19 type KeyBindMode string
20
21 const (
22
23 CommonKeyBind KeyBindMode = "common"
24
25 EmacsKeyBind KeyBindMode = "emacs"
26 )
27
28 var commonKeyBindings = []KeyBind{
29
30 {
31 Key: End,
32 Fn: GoLineEnd,
33 },
34
35 {
36 Key: Home,
37 Fn: GoLineBeginning,
38 },
39
40 {
41 Key: Delete,
42 Fn: DeleteChar,
43 },
44
45 {
46 Key: Backspace,
47 Fn: DeleteBeforeChar,
48 },
49
50 {
51 Key: Right,
52 Fn: GoRightChar,
53 },
54
55 {
56 Key: Left,
57 Fn: GoLeftChar,
58 },
59 }
60
View as plain text