aboutsummaryrefslogtreecommitdiff
path: root/selection.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-11-04 18:01:59 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-11-04 18:01:59 +0000
commita8fb51a34cf488712129850b68566e6b31f0e112 (patch)
tree79728bd6b71fa84ba5cfbfd5f390882b6b971d84 /selection.c
parentinput: don’t use seat->kbd_focus as terminal when processing a key press (diff)
selection: explicitly set direction when right-click extending
Fixes an issue where right-click-and-dragging to extend a selection caused one cell being removed from the selection. Closes #180
Diffstat (limited to 'selection.c')
-rw-r--r--selection.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/selection.c b/selection.c
index 46fd5f1e..a0dfaa02 100644
--- a/selection.c
+++ b/selection.c
@@ -485,17 +485,20 @@ selection_extend_normal(struct terminal *term, int col, int row, uint32_t serial
assert(start->row < end->row || start->col < end->col);
struct coord new_start, new_end;
+ enum selection_scroll_direction direction;
if (row < start->row || (row == start->row && col < start->col)) {
/* Extend selection to start *before* current start */
new_start = *end;
new_end = (struct coord){col, row};
+ direction = SELECTION_LEFT;
}
else if (row > end->row || (row == end->row && col > end->col)) {
/* Extend selection to end *after* current end */
new_start = *start;
new_end = (struct coord){col, row};
+ direction = SELECTION_RIGHT;
}
else {
@@ -509,15 +512,18 @@ selection_extend_normal(struct terminal *term, int col, int row, uint32_t serial
/* Move start point */
new_start = *end;
new_end = (struct coord){col, row};
+ direction = SELECTION_LEFT;
}
else {
/* Move end point */
new_start = *start;
new_end = (struct coord){col, row};
+ direction = SELECTION_RIGHT;
}
}
+ term->selection.direction = direction;
selection_modify(term, new_start, new_end);
}