-
Notifications
You must be signed in to change notification settings - Fork 0
/
def.go
47 lines (43 loc) · 894 Bytes
/
def.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
package cursor
import (
"github.com/blkmlk/microshell/internal/models"
"github.com/sarulabs/di/v2"
)
const DefinitionName = "cursor"
var (
Definition = di.Def{
Name: DefinitionName,
Build: func(ctn di.Container) (interface{}, error) {
return NewCursor(), nil
},
}
)
type Cursor interface {
NewCursor() Cursor
String() string
StringFromPosition() string
StringFromPositionOffset(offset int) string
Flush()
Position() int
SetPosition(position int)
GetRune() models.Rune
Len() int
Swap() int
MoveForward() int
MoveBackward() int
MoveToPrevWord() int
MoveToNextWord() int
MoveToStart() int
MoveToEnd() int
DeleteToStart() int
DeleteToEnd() int
DeleteToPrevWord() int
Backspace() int
Delete() int
WriteString(str string) (int, error)
WriteRune(r models.Rune)
AllWords() []string
AllWordsFromCursor() []string
Words() []string
WordsFromCursor() []string
}