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

Method left

internal/buffer/loc.go:100–111  ·  view source on GitHub ↗

This moves the given location one character to the left

(buf *LineArray)

Source from the content-addressed store, hash-verified

98
99// This moves the given location one character to the left
100func (l Loc) left(buf *LineArray) Loc {
101 if l == buf.Start() {
102 return Loc{l.X - 1, l.Y}
103 }
104 var res Loc
105 if l.X > 0 {
106 res = Loc{l.X - 1, l.Y}
107 } else {
108 res = Loc{util.CharacterCount(buf.LineBytes(l.Y - 1)), l.Y - 1}
109 }
110 return res
111}
112
113// MoveLA moves the cursor n characters to the left or right
114// It moves the cursor left if n is negative

Callers 1

MoveLAMethod · 0.95

Calls 3

CharacterCountFunction · 0.92
LineBytesMethod · 0.65
StartMethod · 0.45

Tested by

no test coverage detected