shithub: vdir

Download patch

ref: 92ee06c644f4426dbe05a20aba234f15f1c8ccd3
parent: 1f799e45543c9fd96a55b7073b5389b6852dded6
author: phil9 <telephil9@gmail.com>
date: Wed Oct 6 14:34:09 EDT 2021

add line flashing upon right click

	this add a visual cue that the item under the cursor as been
	selected and an action will be performed.
	timing seems a bit odd but that will do for now :]

--- a/vdir.c
+++ b/vdir.c
@@ -295,6 +295,18 @@
 }
 
 void
+flash(int n)
+{
+	int i;
+
+	for(i=0; i<5; i++){
+		drawdir(n, i&1);
+		sleep(50);
+		flushimage(display, 1);
+	}
+}
+
+void
 redraw(void)
 {
 	Point p;
@@ -493,9 +505,10 @@
 				redraw();
 			}
 		}else if(ptinrect(m.xy, viewr)){
-			n = (m.xy.y-viewr.min.y)/lineh;
-			if(offset+n>=ndirs)
+			n = indexat(m.xy);
+			if(n==-1)
 				return;
+			flash(n);
 			d = dirs[offset+n];
 			if(d.qid.type & QTDIR){
 				cd(d.name);