This moves the given location one character to the left
(buf *LineArray)
| 98 | |
| 99 | // This moves the given location one character to the left |
| 100 | func (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 |
no test coverage detected