mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-16 22:10:26 +00:00
Fix small issue with regions
This commit is contained in:
parent
ea7f90713c
commit
f637268fa7
1 changed files with 8 additions and 8 deletions
|
|
@ -73,14 +73,6 @@ func FindAllIndex(regex *regexp.Regexp, str []byte, canMatchStart, canMatchEnd b
|
|||
func (h *Highlighter) highlightRegion(start int, canMatchEnd bool, lineNum int, line []byte, region *Region) LineMatch {
|
||||
highlights := make(LineMatch)
|
||||
|
||||
if len(line) == 0 {
|
||||
if canMatchEnd {
|
||||
h.lastRegion = region
|
||||
}
|
||||
|
||||
return highlights
|
||||
}
|
||||
|
||||
loc := FindIndex(region.end, line, start == 0, canMatchEnd)
|
||||
if loc != nil {
|
||||
if region.parent == nil {
|
||||
|
|
@ -95,6 +87,14 @@ func (h *Highlighter) highlightRegion(start int, canMatchEnd bool, lineNum int,
|
|||
h.highlightRegion(start+loc[1], canMatchEnd, lineNum, line[loc[1]:], region.parent)))
|
||||
}
|
||||
|
||||
if len(line) == 0 {
|
||||
if canMatchEnd {
|
||||
h.lastRegion = region
|
||||
}
|
||||
|
||||
return highlights
|
||||
}
|
||||
|
||||
firstLoc := []int{len(line), 0}
|
||||
var firstRegion *Region
|
||||
for _, r := range region.rules.regions {
|
||||
|
|
|
|||
Loading…
Reference in a new issue