1
1
mirror of https://github.com/walles/moar.git synced 2024-08-16 15:30:34 +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 (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
}
}
}