shithub: dmenu

Download patch

ref: 4519e5d0d0836c3993f1ef05fb18bade6e88d6ee
parent: 92964c4ffc4d2cb245749401b5d15614318e45b4
author: glenda <[email protected]>
date: Sun Sep 5 17:41:06 EDT 2021

line: fix redrawing on Kup/Kdown

--- a/line.c
+++ b/line.c
@@ -219,6 +219,8 @@
 static void
 kbmove(int n)
 {
+	int old = selected;
+
 	if(selected + n < 0)
 		selected = 0;
 	else if(selected + n >= nmatches)
@@ -225,14 +227,20 @@
 		selected = nmatches - 1;
 	else
 		selected += n;
+	drawline(old);
+	drawline(selected);
 }
 
 static void
 mselect(Point pt)
 {
-	int old, sel = pointtoline(pt);;
+	int old, sel = pointtoline(pt);
 
-	if(sel >= 0 && sel != selected){
+	if(sel < 0)
+		sel = 0;
+	if(sel >= nmatches)
+		sel = nmatches - 1;
+	if(sel != selected){
 		old = selected;
 		selected = sel;
 		drawline(old);