diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-12-03 18:17:51 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-12-03 18:17:51 +0000 |
| commit | 10cf7226179a8598239eda3be0566b515ecbb11a (patch) | |
| tree | 3878b43ba78e9c9ba26c0be9175957db667bb738 | |
| parent | search: break out search buffer resize code to a new function (diff) | |
search: don't line-wrap unless we actually have a match on the next row
When matching characters, we moved on to next row directly after
matching the last character in a row.
This was wrong since if that last character was the last matching
character, we tried to create a selection that was on the wrong row.
| -rw-r--r-- | search.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -148,10 +148,7 @@ search_update(struct terminal *term) size_t match_len = 0; for (size_t i = 0; i < term->search.len; i++, match_len++) { - if (wcsncasecmp(&row->cells[end_col].wc, &term->search.buf[i], 1) != 0) - break; - - if (++end_col >= term->cols) { + if (end_col >= term->cols) { if (end_row + 1 > grid_row_absolute(term->grid, term->grid->offset + term->rows - 1)) { /* Don't continue past end of the world */ break; @@ -161,6 +158,11 @@ search_update(struct terminal *term) end_col = 0; row = term->grid->rows[end_row]; } + + if (wcsncasecmp(&row->cells[end_col].wc, &term->search.buf[i], 1) != 0) + break; + + end_col++; } if (match_len != term->search.len) { |
