From 7b1994fce62fd18744eeb935611b6a08fae2f538 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 18 Apr 2022 14:47:17 +0200 Subject: search: match iterator: wrap iterator’s row number, when needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- search.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/search.c b/search.c index c60c1a3d..807804bf 100644 --- a/search.c +++ b/search.c @@ -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) { -- cgit v1.3