shithub: riscv

Download patch

ref: 92d3ff842606576887a4d606995c5ac1bf763f43
parent: 5cabb3070c7dbbdce439a3b4ddca4720169eafe7
author: cinap_lenrek <[email protected]>
date: Sat Sep 15 22:49:41 EDT 2012

rio: single line scroll up/down with holding shift key

--- a/sys/src/cmd/rio/dat.h
+++ b/sys/src/cmd/rio/dat.h
@@ -343,3 +343,4 @@
 int		menuing;		/* menu action is pending; waiting for window to be indicated */
 int		snarfversion;	/* updated each time it is written */
 int		messagesize;		/* negotiated in 9P version setup */
+int		shiftdown;
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -345,6 +345,8 @@
 	threadsetname("keyboardthread");
 
 	while(s = recvp(kbdchan)){
+		if(*s == 'k' || *s == 'K')
+			shiftdown = utfrune(s+1, Kshift) != nil;
 		if(input == nil || sendp(input->ck, s) <= 0)
 			free(s);
 	}
--- a/sys/src/cmd/rio/wind.c
+++ b/sys/src/cmd/rio/wind.c
@@ -618,7 +618,7 @@
 	if(!w->mouseopen)
 		switch(r){
 		case Kdown:
-			n = w->maxlines/3;
+			n = shiftdown ? 1 : w->maxlines/3;
 			goto case_Down;
 		case Kscrollonedown:
 			n = mousescrollsize(w->maxlines);
@@ -632,7 +632,7 @@
 			wsetorigin(w, q0, TRUE);
 			return;
 		case Kup:
-			n = w->maxlines/3;
+			n = shiftdown ? 1 : w->maxlines/3;
 			goto case_Up;
 		case Kscrolloneup:
 			n = mousescrollsize(w->maxlines);