From 686882ffcd2e80770cc0172080321bc0c944318f Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Sat, 18 May 2024 08:13:08 +0200 Subject: [PATCH] Improve docs --- m/search.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/m/search.go b/m/search.go index 42cea77..81ffc23 100644 --- a/m/search.go +++ b/m/search.go @@ -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