mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-02 01:40:13 -05:00
search: fix start/end row in selection
This commit is contained in:
parent
64179bce46
commit
b8b43e2eab
1 changed files with 16 additions and 2 deletions
18
search.c
18
search.c
|
|
@ -161,11 +161,25 @@ search_update(struct terminal *term)
|
||||||
if (start_row != term->search.match.row ||
|
if (start_row != term->search.match.row ||
|
||||||
start_col != term->search.match.col)
|
start_col != term->search.match.col)
|
||||||
{
|
{
|
||||||
selection_start(term, start_col, start_row - term->grid->view);
|
int selection_row = start_row - term->grid->view;
|
||||||
|
while (selection_row < 0)
|
||||||
|
selection_row += term->grid->num_rows;
|
||||||
|
|
||||||
|
assert(selection_row >= 0 &&
|
||||||
|
selection_row < term->grid->num_rows);
|
||||||
|
selection_start(term, start_col, selection_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update selection endpoint */
|
/* Update selection endpoint */
|
||||||
selection_update(term, end_col, end_row - term->grid->view);
|
{
|
||||||
|
int selection_row = end_row - term->grid->view;
|
||||||
|
while (selection_row < 0)
|
||||||
|
selection_row += term->grid->num_rows;
|
||||||
|
|
||||||
|
assert(selection_row >= 0 &&
|
||||||
|
selection_row < term->grid->num_rows);
|
||||||
|
selection_update(term, end_col, selection_row);
|
||||||
|
}
|
||||||
|
|
||||||
/* Update match state */
|
/* Update match state */
|
||||||
term->search.match.row = start_row;
|
term->search.match.row = start_row;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue