Search the last match on line when search back (#2156)
This commit is contained in:
parent
33e064b3b9
commit
4a2a72983f
1 changed files with 3 additions and 2 deletions
|
@ -91,9 +91,10 @@ func (b *Buffer) findUp(r *regexp.Regexp, start, end Loc) ([2]Loc, bool) {
|
||||||
l = util.SliceStart(l, end.X)
|
l = util.SliceStart(l, end.X)
|
||||||
}
|
}
|
||||||
|
|
||||||
match := r.FindIndex(l)
|
all_matches := r.FindAllIndex(l, -1)
|
||||||
|
|
||||||
if match != nil {
|
if all_matches != nil {
|
||||||
|
match := all_matches[len(all_matches)-1]
|
||||||
start := Loc{charpos + util.RunePos(l, match[0]), i}
|
start := Loc{charpos + util.RunePos(l, match[0]), i}
|
||||||
end := Loc{charpos + util.RunePos(l, match[1]), i}
|
end := Loc{charpos + util.RunePos(l, match[1]), i}
|
||||||
return [2]Loc{start, end}, true
|
return [2]Loc{start, end}, true
|
||||||
|
|
Loading…
Reference in a new issue