...
1 package prompt
2
3
4 func GoLineEnd(buf *Buffer) {
5 x := []rune(buf.Document().TextAfterCursor())
6 buf.CursorRight(len(x))
7 }
8
9
10 func GoLineBeginning(buf *Buffer) {
11 x := []rune(buf.Document().TextBeforeCursor())
12 buf.CursorLeft(len(x))
13 }
14
15
16 func DeleteChar(buf *Buffer) {
17 buf.Delete(1)
18 }
19
20
21 func DeleteWord(buf *Buffer) {
22 buf.DeleteBeforeCursor(len([]rune(buf.Document().TextBeforeCursor())) - buf.Document().FindStartOfPreviousWordWithSpace())
23 }
24
25
26 func DeleteBeforeChar(buf *Buffer) {
27 buf.DeleteBeforeCursor(1)
28 }
29
30
31 func GoRightChar(buf *Buffer) {
32 buf.CursorRight(1)
33 }
34
35
36 func GoLeftChar(buf *Buffer) {
37 buf.CursorLeft(1)
38 }
39
40
41 func GoRightWord(buf *Buffer) {
42 buf.CursorRight(buf.Document().FindEndOfCurrentWordWithSpace())
43 }
44
45
46 func GoLeftWord(buf *Buffer) {
47 buf.CursorLeft(len([]rune(buf.Document().TextBeforeCursor())) - buf.Document().FindStartOfPreviousWordWithSpace())
48 }
49
View as plain text