From: v4hn <me@v4hn.de>
Date: Thu, 14 May 2015 13:46:07 +0000 (+0200)
Subject: set selection to IDLE on clear
X-Git-Url: https://git.owens.tech/112-editable-focus.html/112-editable-focus.html/git?a=commitdiff_plain;h=8e15887de95a7076b9515dcbb428b364f6dc3849;p=st.git

set selection to IDLE on clear

Otherwise a tangling bmotion event will consider
the selection still valid and selnormalize segfaults
because of an invalid sel.ob.y index.
---

diff --git a/st.c b/st.c
index 73fe291..c0a9bf3 100644
--- a/st.c
+++ b/st.c
@@ -1069,6 +1069,7 @@ void
 selclear(XEvent *e) {
 	if(sel.ob.x == -1)
 		return;
+	sel.mode = SEL_IDLE;
 	sel.ob.x = -1;
 	tsetdirt(sel.nb.y, sel.ne.y);
 }