mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-05-05 06:47:25 -04:00
selection: update: get start-row pointer *after* modifying the start row index
This commit is contained in:
parent
fb9a95494d
commit
56f6e450b0
1 changed files with 6 additions and 5 deletions
11
selection.c
11
selection.c
|
|
@ -561,11 +561,6 @@ selection_update(struct terminal *term, int col, int row)
|
||||||
struct coord new_start = term->selection.start;
|
struct coord new_start = term->selection.start;
|
||||||
struct coord new_end = {col, term->grid->view + row};
|
struct coord new_end = {col, term->grid->view + row};
|
||||||
|
|
||||||
size_t start_row_idx = new_start.row & (term->grid->num_rows - 1);
|
|
||||||
size_t end_row_idx = new_end.row & (term->grid->num_rows - 1);
|
|
||||||
const struct row *row_start = term->grid->rows[start_row_idx];
|
|
||||||
const struct row *row_end = term->grid->rows[end_row_idx];
|
|
||||||
|
|
||||||
/* Adjust start point if the selection has changed 'direction' */
|
/* Adjust start point if the selection has changed 'direction' */
|
||||||
if (!(new_end.row == new_start.row && new_end.col == new_start.col)) {
|
if (!(new_end.row == new_start.row && new_end.col == new_start.col)) {
|
||||||
enum selection_direction new_direction = term->selection.direction;
|
enum selection_direction new_direction = term->selection.direction;
|
||||||
|
|
@ -698,6 +693,12 @@ selection_update(struct terminal *term, int col, int row)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t start_row_idx = new_start.row & (term->grid->num_rows - 1);
|
||||||
|
size_t end_row_idx = new_end.row & (term->grid->num_rows - 1);
|
||||||
|
|
||||||
|
const struct row *row_start = term->grid->rows[start_row_idx];
|
||||||
|
const struct row *row_end = term->grid->rows[end_row_idx];
|
||||||
|
|
||||||
/* If an end point is in the middle of a multi-column character,
|
/* If an end point is in the middle of a multi-column character,
|
||||||
* expand the selection to cover the entire character */
|
* expand the selection to cover the entire character */
|
||||||
if (new_start.row < new_end.row ||
|
if (new_start.row < new_end.row ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue