MCPcopy
hub / github.com/micro-editor/micro / MoveLA

Method MoveLA

internal/buffer/loc.go:115–126  ·  view source on GitHub ↗

MoveLA moves the cursor n characters to the left or right It moves the cursor left if n is negative

(n int, buf *LineArray)

Source from the content-addressed store, hash-verified

113// MoveLA moves the cursor n characters to the left or right
114// It moves the cursor left if n is negative
115func (l Loc) MoveLA(n int, buf *LineArray) Loc {
116 if n > 0 {
117 for i := 0; i < n; i++ {
118 l = l.right(buf)
119 }
120 return l
121 }
122 for i := 0; i < util.Abs(n); i++ {
123 l = l.left(buf)
124 }
125 return l
126}
127
128// Diff returns the difference between two locs
129func (l Loc) Diff(b Loc, buf *Buffer) int {

Callers 3

MoveMethod · 0.95
DoTextEventMethod · 0.80
ApplyDiffMethod · 0.80

Calls 3

rightMethod · 0.95
leftMethod · 0.95
AbsFunction · 0.92

Tested by

no test coverage detected