Skip to content
Snippets Groups Projects
Commit e338a12e authored by George Nachman's avatar George Nachman
Browse files

Add tail find results to the search results array so that find next/previous...

Add tail find results to the search results array so that find next/previous can navigate to them. Issue 5677.
parent e80f90d6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -85,8 +85,7 @@ totalScrollbackOverflow:(long long)totalScrollbackOverflow;
// Erase the find cursor.
- (void)resetFindCursor;
 
// Highlights a search result. TODO: This should add it to the set of search results as well so
// tail-find results can be nagivated with find next/find previous.
// Highlights a search result.
- (void)addSearchResult:(SearchResult *)searchResult width:(int)width;
 
// Search the next block (calling out to the delegate to do the real work) and update highlights and
Loading
Loading
Loading
Loading
@@ -27,7 +27,8 @@
NSString *_lastStringSearchedFor;
 
// The set of SearchResult objects for which matches have been found.
NSMutableArray *_searchResults;
// Sorted by reverse position (last in the buffer is first in the array).
NSMutableArray<SearchResult *> *_searchResults;
 
// The next offset into _searchResults where values from _searchResults should
// be added to the map.
Loading
Loading
@@ -165,9 +166,10 @@
BOOL redraw = NO;
 
assert([self findInProgress]);
NSMutableArray<SearchResult *> *newSearchResults = [NSMutableArray array];
if (_findInProgress) {
// Collect more results.
more = [_delegate continueFindAllResults:_searchResults
more = [_delegate continueFindAllResults:newSearchResults
inContext:context];
*progress = [context progress];
} else {
Loading
Loading
@@ -177,8 +179,7 @@
_findInProgress = NO;
}
// Add new results to map.
for (int i = _numberOfProcessedSearchResults; i < [_searchResults count]; i++) {
SearchResult* r = [_searchResults objectAtIndex:i];
for (SearchResult *r in newSearchResults.reverseObjectEnumerator) {
[self addSearchResult:r width:width];
redraw = YES;
}
Loading
Loading
@@ -202,6 +203,7 @@
}
 
- (void)addSearchResult:(SearchResult *)searchResult width:(int)width {
[_searchResults insertObject:searchResult atIndex:0];
for (long long y = searchResult.absStartY; y <= searchResult.absEndY; y++) {
NSNumber* key = [NSNumber numberWithLongLong:y];
NSMutableData* data = _highlightMap[key];
Loading
Loading
@@ -271,14 +273,14 @@
if (!found &&
((maxPos >= 0 && pos <= maxPos) ||
(minPos >= 0 && pos >= minPos))) {
found = YES;
selectedRange =
VT100GridCoordRangeMake(r.startX,
r.absStartY - overflowAdjustment,
r.endX + 1, // half-open
r.absEndY - overflowAdjustment);
[_delegate findOnPageSelectRange:selectedRange wrapped:NO];
}
found = YES;
selectedRange =
VT100GridCoordRangeMake(r.startX,
r.absStartY - overflowAdjustment,
r.endX + 1, // half-open
r.absEndY - overflowAdjustment);
[_delegate findOnPageSelectRange:selectedRange wrapped:NO];
}
i += stride;
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment