svn commit: trunk/busybox/miscutils

vda at busybox.net vda at busybox.net
Fri Mar 9 08:55:24 UTC 2007


Author: vda
Date: 2007-03-09 00:55:23 -0800 (Fri, 09 Mar 2007)
New Revision: 18050

Log:
less: handle yet another Home/End key sequence; expand a comment


Modified:
   trunk/busybox/miscutils/less.c


Changeset:
Modified: trunk/busybox/miscutils/less.c
===================================================================
--- trunk/busybox/miscutils/less.c	2007-03-09 08:46:31 UTC (rev 18049)
+++ trunk/busybox/miscutils/less.c	2007-03-09 08:55:23 UTC (rev 18050)
@@ -48,8 +48,10 @@
 	REAL_KEY_LEFT = 'D',
 	REAL_PAGE_UP = '5',
 	REAL_PAGE_DOWN = '6',
-	REAL_KEY_HOME = '7',
+	REAL_KEY_HOME = '7', // vt100? linux vt? or what?
 	REAL_KEY_END = '8',
+	REAL_KEY_HOME_ALT = '1', // ESC [1~ (vt100? linux vt? or what?)
+	REAL_KEY_END_ALT = '4', // ESC [4~ 
 	REAL_KEY_HOME_XTERM = 'H',
 	REAL_KEY_END_XTERM = 'F',
 
@@ -213,9 +215,12 @@
 					if (errno == EAGAIN && !yielded) {
 			/* We can hit EAGAIN while searching for regexp match.
 			 * Yield is not 100% reliable solution in general,
-			 * but for less it should be good enough.
-			 * We give stdin supplier some CPU time to produce more.
-			 * We do it just once. */
+			 * but for less it should be good enough -
+			 * we give stdin supplier some CPU time to produce
+			 * more input. We do it just once.
+			 * Currently, we do not stop when we found the Nth
+			 * occurrence we were looking for. We read till end
+			 * (or double EAGAIN). TODO? */
 						sched_yield();
 						yielded = 1;
 						goto read_again;
@@ -638,8 +643,12 @@
 			return 24 + i;
 		if (input[2] == REAL_KEY_HOME_XTERM)
 			return KEY_HOME;
+		if (input[2] == REAL_KEY_HOME_ALT)
+			return KEY_HOME;
 		if (input[2] == REAL_KEY_END_XTERM)
 			return KEY_END;
+		if (input[2] == REAL_KEY_END_ALT)
+			return KEY_END;
 		return 0;
 	}
 	/* Reject almost all control chars */




More information about the busybox-cvs mailing list