aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-27 19:09:37 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-27 19:09:37 +0000
commit275915228584e665f71266da30084c9ef5d67b14 (patch)
tree86575e3bd59c1eb1f7b78a0cc087b9c759fbccdb
parentselection: allow selections while searching scrollback (diff)
search: loop through the *entire* scrollback buffer
-rw-r--r--search.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/search.c b/search.c
index 992de851..a44ca7ec 100644
--- a/search.c
+++ b/search.c
@@ -66,11 +66,13 @@ search_update(struct terminal *term)
LOG_DBG("search: update: starting at row=%d col=%d", start_row, start_col);
+#define ROW_DEC(_r) ((_r) = ((_r) - 1 + term->grid->num_rows) % term->grid->num_rows)
+
/* Scan backward from current end-of-output */
- for (; start_row >= 0; start_row--) {
+ for (size_t r = 0; r < term->grid->num_rows; ROW_DEC(start_row), r++) {
const struct row *row = term->grid->rows[start_row];
if (row == NULL)
- break;
+ continue;
for (; start_col >= 0; start_col--) {
if (row->cells[start_col].wc != term->search.buf[0])
@@ -175,9 +177,12 @@ search_update(struct terminal *term)
}
/* No match */
+ LOG_DBG("no match");
term->search.match = (struct coord){-1, -1};
term->search.match_len = 0;
selection_cancel(term);
+
+#undef ROW_DEC
}
void