mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
Fix backwards search performance issue
This problem was here all along, but it was excarberated by the newly introduced parallel search.
This commit is contained in:
parent
7b032b2fa4
commit
f434895eef
10
m/search.go
10
m/search.go
@ -145,18 +145,18 @@ func (p *Pager) _findFirstHit(startPosition linenumbers.LineNumber, beforePositi
|
||||
|
||||
if backwards {
|
||||
if (searchPosition == linenumbers.LineNumber{}) {
|
||||
// No match, give up
|
||||
// Reached the top without any match, give up
|
||||
return nil
|
||||
}
|
||||
|
||||
searchPosition = searchPosition.NonWrappingAdd(-1)
|
||||
} else {
|
||||
searchPosition = searchPosition.NonWrappingAdd(1)
|
||||
}
|
||||
|
||||
if beforePosition != nil && searchPosition == *beforePosition {
|
||||
// No match, give up
|
||||
return nil
|
||||
}
|
||||
if beforePosition != nil && searchPosition == *beforePosition {
|
||||
// No match, give up
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user