From 7b1994fce62fd18744eeb935611b6a08fae2f538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 18 Apr 2022 14:47:17 +0200 Subject: [PATCH] =?UTF-8?q?search:=20match=20iterator:=20wrap=20iterator?= =?UTF-8?q?=E2=80=99s=20row=20number,=20when=20needed?= 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) {