@@ -59,7 +59,6 @@ func parseMatches(
59
59
hi .lineEnd = line
60
60
61
61
graphemeStart := graphemePos
62
- graphemeEnd := graphemePos
63
62
64
63
// loop until we find the end
65
64
for byteEnd > bytePos {
@@ -69,9 +68,8 @@ func parseMatches(
69
68
70
69
// if it ends with a new line, add the range, increase line, and continue
71
70
if content [bytePos ] == '\n' {
72
- graphemeEnd = graphemePos
73
71
colstart := max (0 , graphemeStart - previousLinesOffset )
74
- colend := max (graphemeEnd - previousLinesOffset + 1 , colstart ) // +1 its \n itself
72
+ colend := max (graphemePos - previousLinesOffset + 1 , colstart ) // +1 its \n itself
75
73
76
74
// fmt.Printf(
77
75
// "nl line=%d linestart=%d lineend=%d colstart=%d colend=%d start=%d end=%d processed=%d width=%d\n",
@@ -93,9 +91,8 @@ func parseMatches(
93
91
94
92
// we found it!, add highlight and continue
95
93
if bytePos == byteEnd {
96
- graphemeEnd = graphemePos
97
94
colstart := max (0 , graphemeStart - previousLinesOffset )
98
- colend := max (graphemeEnd - previousLinesOffset , colstart )
95
+ colend := max (graphemePos - previousLinesOffset , colstart )
99
96
100
97
// fmt.Printf(
101
98
// "no line=%d linestart=%d lineend=%d colstart=%d colend=%d start=%d end=%d processed=%d width=%d\n",
@@ -106,7 +103,6 @@ func parseMatches(
106
103
hi .lines [line ] = [2 ]int {colstart , colend }
107
104
hi .lineEnd = line
108
105
}
109
-
110
106
}
111
107
112
108
highlights = append (highlights , hi )
@@ -125,7 +121,7 @@ type highlightInfo struct {
125
121
126
122
// coords returns the line x column of this highlight.
127
123
func (hi highlightInfo ) coords () (line int , col int ) {
128
- for i := hi .lineStart ; i <= hi .lineEnd ; i ++ {
124
+ for i := hi .lineStart ; i < hi .lineEnd ; i ++ {
129
125
hl , ok := hi .lines [i ]
130
126
if ! ok {
131
127
continue
0 commit comments