mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
selection: min_bufsize_for_extraction: add one extra column for *all* rows
This commit is contained in:
parent
4c78b0203e
commit
a83c9e2813
1 changed files with 4 additions and 7 deletions
11
selection.c
11
selection.c
|
|
@ -162,14 +162,11 @@ min_bufsize_for_extraction(const struct terminal *term)
|
|||
else {
|
||||
size_t cells = 0;
|
||||
|
||||
/* First row; start of selection to end of row */
|
||||
cells += term->cols - start->col;
|
||||
/* Add one extra column on each row, for \n */
|
||||
|
||||
/* Full rows; add one extra column for \n */
|
||||
cells += term->cols - start->col + 1;
|
||||
cells += (term->cols + 1) * (end->row - start->row - 1);
|
||||
|
||||
/* Final row; start of row to end of selection */
|
||||
cells += end->col + 1;
|
||||
cells += end->col + 1 + 1;
|
||||
return cells;
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +181,7 @@ min_bufsize_for_extraction(const struct terminal *term)
|
|||
.col = max(start->col, end->col),
|
||||
};
|
||||
|
||||
/* Add one extra column for \n */
|
||||
/* Add one extra column on each row, for \n */
|
||||
int cols = bottom_right.col - top_left.col + 1 + 1;
|
||||
int rows = bottom_right.row - top_left.row + 1;
|
||||
return rows * cols;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue