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
This commit is contained in:
Daniel Eklöf 2022-02-07 10:38:30 +01:00
parent b4027118e6
commit a187271ca4
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -3681,6 +3681,16 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
if (term->grid == &term->alt)
selection_cancel(term);
else {
/*
* Dont cancel, but make sure there arent 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,