From 92f5fa03d368eaeb402347ac8c76f8fb564d3e8a Mon Sep 17 00:00:00 2001
From: Alexander Sedov <alex0player@gmail.com>
Date: Tue, 19 Feb 2013 22:22:55 +0400
Subject: [PATCH 9/9] Fixed selection redrawing quirks.
To: dev@suckless.org

---
 st.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/st.c b/st.c
index 82f935b..42d1ac3 100644
--- a/st.c
+++ b/st.c
@@ -935,6 +935,7 @@ brelease(XEvent *e) {
 void
 bmotion(XEvent *e) {
 	int oldey, oldex;
+	int oldb_y, olde_y;
 
 	if(IS_SET(MODE_MOUSE)) {
 		mousereport(e);
@@ -946,10 +947,12 @@ bmotion(XEvent *e) {
 
 	oldey = sel.ey;
 	oldex = sel.ex;
+	oldb_y = sel.b.y;
+	olde_y = sel.e.y;
 	getbuttoninfo(e);
 
 	if(oldey != sel.ey || oldex != sel.ex) {
-		tsetdirt(sel.b.y, sel.e.y);
+		tsetdirt(MIN(sel.b.y, oldb_y), MAX(sel.e.y, olde_y));
 	}
 }
 
-- 
1.7.10.4

