aboutsummaryrefslogtreecommitdiff
path: root/selection.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-02-07 12:56:55 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-02-07 14:06:39 +0000
commit2e828248d07490bd56baa3458a970e1ad34ede7c (patch)
treee4217fd70d9b4ceebe92797f8ef934f938ec7e67 /selection.c
parentMerge branch 'finalize-selection-on-window-resize' (diff)
selection: ensure start/end coordinates are bounded by the current grid
Closes #924
Diffstat (limited to 'selection.c')
-rw-r--r--selection.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/selection.c b/selection.c
index 0ed25cd7..5d2cd61d 100644
--- a/selection.c
+++ b/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: