mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
selection: foreach_selected_*(): refactor: use grid_row_abs_to_sb()
This commit is contained in:
parent
a05eaf28bd
commit
6ebf55572e
1 changed files with 5 additions and 6 deletions
11
selection.c
11
selection.c
|
|
@ -181,14 +181,14 @@ foreach_selected_normal(
|
||||||
const struct coord *start = &_start;
|
const struct coord *start = &_start;
|
||||||
const struct coord *end = &_end;
|
const struct coord *end = &_end;
|
||||||
|
|
||||||
const int scrollback_start = term->grid->offset + term->rows;
|
|
||||||
const int grid_rows = term->grid->num_rows;
|
const int grid_rows = term->grid->num_rows;
|
||||||
|
|
||||||
|
/* Start/end rows, relative to the scrollback start */
|
||||||
/* Start/end rows, relative to the scrollback start */
|
/* Start/end rows, relative to the scrollback start */
|
||||||
const int rel_start_row =
|
const int rel_start_row =
|
||||||
(start->row - scrollback_start + grid_rows) & (grid_rows - 1);
|
grid_row_abs_to_sb(term->grid, term->rows, start->row);
|
||||||
const int rel_end_row =
|
const int rel_end_row =
|
||||||
(end->row - scrollback_start + grid_rows) & (grid_rows - 1);
|
grid_row_abs_to_sb(term->grid, term->rows, end->row);
|
||||||
|
|
||||||
int start_row, end_row;
|
int start_row, end_row;
|
||||||
int start_col, end_col;
|
int start_col, end_col;
|
||||||
|
|
@ -244,14 +244,13 @@ foreach_selected_block(
|
||||||
const struct coord *start = &_start;
|
const struct coord *start = &_start;
|
||||||
const struct coord *end = &_end;
|
const struct coord *end = &_end;
|
||||||
|
|
||||||
const int scrollback_start = term->grid->offset + term->rows;
|
|
||||||
const int grid_rows = term->grid->num_rows;
|
const int grid_rows = term->grid->num_rows;
|
||||||
|
|
||||||
/* Start/end rows, relative to the scrollback start */
|
/* Start/end rows, relative to the scrollback start */
|
||||||
const int rel_start_row =
|
const int rel_start_row =
|
||||||
(start->row - scrollback_start + grid_rows) & (grid_rows - 1);
|
grid_row_abs_to_sb(term->grid, term->rows, start->row);
|
||||||
const int rel_end_row =
|
const int rel_end_row =
|
||||||
(end->row - scrollback_start + grid_rows) & (grid_rows - 1);
|
grid_row_abs_to_sb(term->grid, term->rows, end->row);
|
||||||
|
|
||||||
struct coord top_left = {
|
struct coord top_left = {
|
||||||
.row = (rel_start_row < rel_end_row
|
.row = (rel_start_row < rel_end_row
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue