mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
selection: ensure start/end coordinates are bounded by the current grid
Closes #924
This commit is contained in:
parent
3baf7de3b8
commit
2e828248d0
1 changed files with 2 additions and 10 deletions
12
selection.c
12
selection.c
|
|
@ -1108,16 +1108,8 @@ selection_finalize(struct seat *seat, struct terminal *term, uint32_t serial)
|
|||
xassert(term->selection.start.row != -1);
|
||||
xassert(term->selection.end.row != -1);
|
||||
|
||||
if (term->selection.start.row > term->selection.end.row ||
|
||||
(term->selection.start.row == term->selection.end.row &&
|
||||
term->selection.start.col > term->selection.end.col))
|
||||
{
|
||||
struct coord tmp = term->selection.start;
|
||||
term->selection.start = term->selection.end;
|
||||
term->selection.end = tmp;
|
||||
}
|
||||
|
||||
xassert(term->selection.start.row <= term->selection.end.row);
|
||||
term->selection.start.row &= (term->grid->num_rows - 1);
|
||||
term->selection.end.row &= (term->grid->num_rows - 1);
|
||||
|
||||
switch (term->conf->selection_target) {
|
||||
case SELECTION_TARGET_NONE:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue