aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-02-07 09:38:30 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-02-07 09:38:30 +0000
commita187271ca4ba491c7614de540c4490e0f6fa118d (patch)
treeb5b97040eaac35cd6ac82010679a5d37cc2305d7 /render.c
parentterm: init: initialize selection pivot point coords to -1,-1 (diff)
render: resize: finalize selection before reflowing the grid
This fixes a crash caused by the selection’s pivot point not being translated during reflow. While we could simply reflow the pivot point as well, testing shows irregular behavior with ongoing selections across window resizes, with different compositors behaving differently. For now, we simply finalize the selection, instead of trying to handle ongoing selections. Closes #922
Diffstat (limited to 'render.c')
-rw-r--r--render.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/render.c b/render.c
index 024d0954..e189e1a0 100644
--- a/render.c
+++ b/render.c
@@ -3681,6 +3681,16 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
if (term->grid == &term->alt)
selection_cancel(term);
+ else {
+ /*
+ * Don’t cancel, but make sure there aren’t any ongoing
+ * selections after the resize.
+ */
+ tll_foreach(term->wl->seats, it) {
+ if (it->item.kbd_focus == term)
+ selection_finalize(&it->item, term, it->item.pointer.serial);
+ }
+ }
struct coord *const tracking_points[] = {
&term->selection.start,