shithub: nc

Download patch

ref: ebae74851bf08ade421fc24cc7f07475506fe6f4
parent: c5781f2980bc24cedb4606f39d3178b8349a8908
author: phil9 <telephil9@gmail.com>
date: Sat Dec 31 02:02:13 EST 2022

add mouse wheel scrolling in panel

	this basically sends key events to simulate up and down arrows presses
	also change mouse clicks to send an Enter key press.

--- a/a.h
+++ b/a.h
@@ -112,7 +112,6 @@
 void		dirviewemouse(Dirview*, Mouse);
 Dirpanel*	dirviewcurrentpanel(Dirview*);
 Dirpanel*	dirviewotherpanel(Dirview*);
-void		cmdview(void);
 
 Dirmodel*	mkdirmodel(char*);
 Dir			dirmodelgetdir(Dirmodel*, int);
--- a/dirpanel.c
+++ b/dirpanel.c
@@ -194,9 +194,12 @@
 		n = (pt.y - p->filesr.min.y) / (font->height+2);
 		if(n < p->nlines){
 			p->cursor = n;
-			cmdview(); /* ugly hack */
+			sendul(kc->c, L'\n');
 		}
-	}
+	}else if(m.buttons == 8)
+		sendul(kc->c, Kup);
+	else if(m.buttons == 16)
+		sendul(kc->c, Kdown);
 }
 
 void
--- a/dirviewcmd.c
+++ b/dirviewcmd.c
@@ -24,7 +24,7 @@
 	setmode(Mhelp);
 }
 
-void
+static void
 cmdview(void)
 {
 	Dirpanel *p;