selection: finalize: clear ongoing selection

Check for ongoing selection, and *clear* it before bailing out due to
the selection not having an end-point.

This fixes an issue where a selection was kept as ongoing, even though
the button had been released. Typically triggered by clicking without
moving the mouse; this started a new selection, then (tried to)
finalize it, but failed since the selection didn't have an end-point.
This commit is contained in:
Daniel Eklöf 2020-08-11 10:15:01 +02:00
parent cddeaa2c1c
commit 9517c6443c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -567,14 +567,14 @@ selection_extend(struct seat *seat, struct terminal *term,
void
selection_finalize(struct seat *seat, struct terminal *term, uint32_t serial)
{
if (term->selection.start.row < 0 || term->selection.end.row < 0)
return;
if (!term->selection.ongoing)
return;
term->selection.ongoing = false;
if (term->selection.start.row < 0 || term->selection.end.row < 0)
return;
assert(term->selection.start.row != -1);
assert(term->selection.end.row != -1);