summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorDenis Vlasenko2007-03-09 08:55:23 +0000
committerDenis Vlasenko2007-03-09 08:55:23 +0000
commitf5a157615d8c788dd214896db8d920ad2f1a8f4e (patch)
tree5261cce9d72d53489c445fb814499b2a3a13eb07 /miscutils
parente11b4a470576ca8971d289edeb7ad931e60f3323 (diff)
downloadbusybox-f5a157615d8c788dd214896db8d920ad2f1a8f4e.zip
busybox-f5a157615d8c788dd214896db8d920ad2f1a8f4e.tar.gz
less: handle yet another Home/End key sequence; expand a comment
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/less.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/miscutils/less.c b/miscutils/less.c
index 31055a6..79732cc 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -48,8 +48,10 @@ enum {
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 @@ static void read_lines(void)
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 @@ static int less_getch(void)
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 */