1
1
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:
Johan Walles 2024-05-18 08:37:06 +02:00
parent 7b032b2fa4
commit f434895eef

View File

@ -145,18 +145,18 @@ func (p *Pager) _findFirstHit(startPosition linenumbers.LineNumber, beforePositi
if backwards { if backwards {
if (searchPosition == linenumbers.LineNumber{}) { if (searchPosition == linenumbers.LineNumber{}) {
// No match, give up // Reached the top without any match, give up
return nil return nil
} }
searchPosition = searchPosition.NonWrappingAdd(-1) searchPosition = searchPosition.NonWrappingAdd(-1)
} else { } else {
searchPosition = searchPosition.NonWrappingAdd(1) searchPosition = searchPosition.NonWrappingAdd(1)
}
if beforePosition != nil && searchPosition == *beforePosition { if beforePosition != nil && searchPosition == *beforePosition {
// No match, give up // No match, give up
return nil return nil
}
} }
} }
} }