aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-12-03 19:00:38 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-12-03 19:00:38 +0000
commit008281757b007cfed3b1ebf22b7879d68820aaef (patch)
tree1d2611bd108a7442f4794578ce5a0ac2844dcd81
parentrender: don't allow negative coordinates of the search surface (diff)
search: bug: re-initialize start-row when attempting a new match
When we've already found a partial match (but *not* a complete match), and that match spanned multiple lines, then when we continued with the next start-column we re-used a know-wrong row pointer.
-rw-r--r--search.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/search.c b/search.c
index 47793823..3609f81c 100644
--- a/search.c
+++ b/search.c
@@ -194,14 +194,14 @@ search_find_next(struct terminal *term)
r < term->grid->num_rows;
backward ? ROW_DEC(start_row) : ROW_INC(start_row), r++)
{
- const struct row *row = term->grid->rows[start_row];
- if (row == NULL)
- continue;
-
for (;
backward ? start_col >= 0 : start_col < term->cols;
backward ? start_col-- : start_col++)
{
+ const struct row *row = term->grid->rows[start_row];
+ if (row == NULL)
+ continue;
+
if (wcsncasecmp(&row->cells[start_col].wc, term->search.buf, 1) != 0)
continue;