mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Fix multiline highlight issue
This commit is contained in:
@@ -240,7 +240,6 @@ func Match(v *View) SyntaxMatches {
|
|||||||
|
|
||||||
str := strings.Join(buf.lines[totalStart:totalEnd], "\n")
|
str := strings.Join(buf.lines[totalStart:totalEnd], "\n")
|
||||||
startNum := v.cursor.loc + v.cursor.Distance(0, totalStart)
|
startNum := v.cursor.loc + v.cursor.Distance(0, totalStart)
|
||||||
toplineNum := v.cursor.loc + v.cursor.Distance(0, v.topline)
|
|
||||||
|
|
||||||
for _, rule := range rules {
|
for _, rule := range rules {
|
||||||
if rule.startend {
|
if rule.startend {
|
||||||
@@ -251,11 +250,17 @@ func Match(v *View) SyntaxMatches {
|
|||||||
value[1] += startNum
|
value[1] += startNum
|
||||||
for i := value[0]; i < value[1]; i++ {
|
for i := value[0]; i < value[1]; i++ {
|
||||||
colNum, lineNum := GetPos(i, buf)
|
colNum, lineNum := GetPos(i, buf)
|
||||||
v.m.Message(strconv.Itoa(lineNum) + ", " + strconv.Itoa(colNum))
|
if lineNum == -1 || colNum == -1 {
|
||||||
if i >= toplineNum {
|
continue
|
||||||
if lineNum != -1 && colNum != -1 {
|
}
|
||||||
matches[lineNum][colNum] = rule.style
|
lineNum -= viewStart
|
||||||
|
if lineNum >= 0 && lineNum < v.height {
|
||||||
|
if lineNum >= len(matches) {
|
||||||
|
v.m.Error("Line " + strconv.Itoa(lineNum))
|
||||||
|
} else if colNum >= len(matches[lineNum]) {
|
||||||
|
v.m.Error("Line " + strconv.Itoa(lineNum) + " Col " + strconv.Itoa(colNum) + " " + strconv.Itoa(len(matches[lineNum])))
|
||||||
}
|
}
|
||||||
|
matches[lineNum][colNum] = rule.style
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user