mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-17 22:05:22 -05:00
search: loop through the *entire* scrollback buffer
This commit is contained in:
parent
58d0657a97
commit
2759152285
1 changed files with 7 additions and 2 deletions
9
search.c
9
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue