File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -9,23 +9,23 @@ type Loc struct {
99 X , Y int
1010}
1111
12- // LessThan returns true if b is smaller
12+ // LessThan returns true if l is smaller than b
1313func (l Loc ) LessThan (b Loc ) bool {
1414 if l .Y < b .Y {
1515 return true
1616 }
1717 return l .Y == b .Y && l .X < b .X
1818}
1919
20- // GreaterThan returns true if b is bigger
20+ // GreaterThan returns true if l is bigger than b
2121func (l Loc ) GreaterThan (b Loc ) bool {
2222 if l .Y > b .Y {
2323 return true
2424 }
2525 return l .Y == b .Y && l .X > b .X
2626}
2727
28- // GreaterEqual returns true if b is greater than or equal to b
28+ // GreaterEqual returns true if l is greater than or equal to b
2929func (l Loc ) GreaterEqual (b Loc ) bool {
3030 if l .Y > b .Y {
3131 return true
@@ -36,7 +36,7 @@ func (l Loc) GreaterEqual(b Loc) bool {
3636 return l == b
3737}
3838
39- // LessEqual returns true if b is less than or equal to b
39+ // LessEqual returns true if l is less than or equal to b
4040func (l Loc ) LessEqual (b Loc ) bool {
4141 if l .Y < b .Y {
4242 return true
@@ -113,14 +113,13 @@ func (l Loc) left(buf *LineArray) Loc {
113113// MoveLA moves the cursor n characters to the left or right
114114// It moves the cursor left if n is negative
115115func (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
116+ for n > 0 {
117+ l = l .right (buf )
118+ n --
121119 }
122- for i := 0 ; i < util . Abs ( n ); i ++ {
120+ for n < 0 {
123121 l = l .left (buf )
122+ n ++
124123 }
125124 return l
126125}
You can’t perform that action at this time.
0 commit comments