search: matches_next: stop searching when start.row >= term->rows

As this means the last call to sarch_matches_next() found a match at
the bottom of the view, and then set the iter’s *next* start position
to a row outside the view.

This is fine, but we need to handle it, by immediately stopping the
iter.
This commit is contained in:
Daniel Eklöf 2022-04-23 12:28:12 +02:00
parent d068e821d6
commit 082e242ce5
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -539,7 +539,16 @@ search_matches_next(struct search_match_iterator *iter)
/* First, return the primary match */
match = term->selection.coords;
found = true;
} else {
}
else if (iter->start.row >= term->rows) {
goto no_match;
}
else {
xassert(iter->start.row >= 0);
xassert(iter->start.row < term->rows);
struct coord abs_start = iter->start;
abs_start.row = grid_row_absolute_in_view(grid, abs_start.row);