search: match iterator: wrap iterator’s row number, when needed

This commit is contained in:
Daniel Eklöf 2022-04-18 14:47:17 +02:00
parent a9ed719f90
commit 7b1994fce6
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -530,6 +530,12 @@ search_matches_next(struct search_match_iterator *iter)
iter->start.row = match.start.row;
iter->start.col = match.start.col + 1;
if (iter->start.col >= term->cols) {
iter->start.col = 0;
iter->start.row++;
iter->start.row &= grid->num_rows - 1;
}
if (match.start.row == term->search.match.row &&
match.start.col == term->search.match.col)
{