diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-09 08:55:23 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-09 08:55:23 +0000 |
commit | f5a157615d8c788dd214896db8d920ad2f1a8f4e (patch) | |
tree | 5261cce9d72d53489c445fb814499b2a3a13eb07 /miscutils/less.c | |
parent | e11b4a470576ca8971d289edeb7ad931e60f3323 (diff) | |
download | busybox-w32-f5a157615d8c788dd214896db8d920ad2f1a8f4e.tar.gz busybox-w32-f5a157615d8c788dd214896db8d920ad2f1a8f4e.tar.bz2 busybox-w32-f5a157615d8c788dd214896db8d920ad2f1a8f4e.zip |
less: handle yet another Home/End key sequence; expand a comment
Diffstat (limited to 'miscutils/less.c')
-rw-r--r-- | miscutils/less.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index 31055a6c7..79732cc41 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -48,8 +48,10 @@ enum { | |||
48 | REAL_KEY_LEFT = 'D', | 48 | REAL_KEY_LEFT = 'D', |
49 | REAL_PAGE_UP = '5', | 49 | REAL_PAGE_UP = '5', |
50 | REAL_PAGE_DOWN = '6', | 50 | REAL_PAGE_DOWN = '6', |
51 | REAL_KEY_HOME = '7', | 51 | REAL_KEY_HOME = '7', // vt100? linux vt? or what? |
52 | REAL_KEY_END = '8', | 52 | REAL_KEY_END = '8', |
53 | REAL_KEY_HOME_ALT = '1', // ESC [1~ (vt100? linux vt? or what?) | ||
54 | REAL_KEY_END_ALT = '4', // ESC [4~ | ||
53 | REAL_KEY_HOME_XTERM = 'H', | 55 | REAL_KEY_HOME_XTERM = 'H', |
54 | REAL_KEY_END_XTERM = 'F', | 56 | REAL_KEY_END_XTERM = 'F', |
55 | 57 | ||
@@ -213,9 +215,12 @@ static void read_lines(void) | |||
213 | if (errno == EAGAIN && !yielded) { | 215 | if (errno == EAGAIN && !yielded) { |
214 | /* We can hit EAGAIN while searching for regexp match. | 216 | /* We can hit EAGAIN while searching for regexp match. |
215 | * Yield is not 100% reliable solution in general, | 217 | * Yield is not 100% reliable solution in general, |
216 | * but for less it should be good enough. | 218 | * but for less it should be good enough - |
217 | * We give stdin supplier some CPU time to produce more. | 219 | * we give stdin supplier some CPU time to produce |
218 | * We do it just once. */ | 220 | * more input. We do it just once. |
221 | * Currently, we do not stop when we found the Nth | ||
222 | * occurrence we were looking for. We read till end | ||
223 | * (or double EAGAIN). TODO? */ | ||
219 | sched_yield(); | 224 | sched_yield(); |
220 | yielded = 1; | 225 | yielded = 1; |
221 | goto read_again; | 226 | goto read_again; |
@@ -638,8 +643,12 @@ static int less_getch(void) | |||
638 | return 24 + i; | 643 | return 24 + i; |
639 | if (input[2] == REAL_KEY_HOME_XTERM) | 644 | if (input[2] == REAL_KEY_HOME_XTERM) |
640 | return KEY_HOME; | 645 | return KEY_HOME; |
646 | if (input[2] == REAL_KEY_HOME_ALT) | ||
647 | return KEY_HOME; | ||
641 | if (input[2] == REAL_KEY_END_XTERM) | 648 | if (input[2] == REAL_KEY_END_XTERM) |
642 | return KEY_END; | 649 | return KEY_END; |
650 | if (input[2] == REAL_KEY_END_ALT) | ||
651 | return KEY_END; | ||
643 | return 0; | 652 | return 0; |
644 | } | 653 | } |
645 | /* Reject almost all control chars */ | 654 | /* Reject almost all control chars */ |