1
1
mirror of https://github.com/walles/moar.git synced 2024-08-16 15:30:34 +03:00

Improve docs

This commit is contained in:
Johan Walles 2024-05-18 08:13:08 +02:00
parent 60d3577b59
commit 686882ffcd

View File

@ -40,12 +40,15 @@ func (p *Pager) scrollToSearchHits() {
}
// NOTE: When we search, we do that by looping over the *input lines*, not the
// screen lines. That's why we're using a line number rather than a
// scrollPosition for searching.
// screen lines. That's why startPosition is a LineNumber rather than a
// scrollPosition.
//
// The `beforePosition` parameter is exclusive, meaning that line will not be
// searched.
//
// For the actual searching, this method will call _findFirstHit() in parallel
// on multiple cores, to help large file search performance.
//
// FIXME: We should take startPosition.deltaScreenLines into account as well!
func (p *Pager) findFirstHit(startPosition linenumbers.LineNumber, beforePosition *linenumbers.LineNumber, backwards bool) *scrollPosition {
// If the number of lines to search matches the number of cores (or more),
@ -116,12 +119,15 @@ func (p *Pager) findFirstHit(startPosition linenumbers.LineNumber, beforePositio
}
// NOTE: When we search, we do that by looping over the *input lines*, not the
// screen lines. That's why we're using a line number rather than a
// scrollPosition for searching.
// screen lines. That's why startPosition is a LineNumber rather than a
// scrollPosition.
//
// The `beforePosition` parameter is exclusive, meaning that line will not be
// searched.
//
// This method will run over multiple chunks of the input file in parallel to
// help large file search performance.
//
// FIXME: We should take startPosition.deltaScreenLines into account as well!
func (p *Pager) _findFirstHit(startPosition linenumbers.LineNumber, beforePosition *linenumbers.LineNumber, backwards bool) *scrollPosition {
searchPosition := startPosition