diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-25 23:50:56 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-25 23:50:56 +0100 |
commit | a17eeb847e66824c4d389751cc90415d3fc1c5a3 (patch) | |
tree | a5dd027573c002641942191f8ae1f7c7b1f7429e /libbb/read_key.c | |
parent | 77c066ea5cf4b1ee606a81e48388ff0b1d019134 (diff) | |
download | busybox-w32-a17eeb847e66824c4d389751cc90415d3fc1c5a3.tar.gz busybox-w32-a17eeb847e66824c4d389751cc90415d3fc1c5a3.tar.bz2 busybox-w32-a17eeb847e66824c4d389751cc90415d3fc1c5a3.zip |
lineedit: handle Ctrl-arrows
function old new delta
read_line_input 4629 4824 +195
BB_isalnum - 39 +39
BB_ispunct - 35 +35
BB_isspace - 31 +31
static.esccmds 69 93 +24
vi_word_motion 165 162 -3
vi_back_motion 204 198 -6
vi_end_motion 172 163 -9
bb_iswspace 28 - -28
bb_iswpunct 32 - -32
bb_iswalnum 37 - -37
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 5/8 up/down: 334/-129) Total: 205 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/read_key.c')
-rw-r--r-- | libbb/read_key.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libbb/read_key.c b/libbb/read_key.c index d3832fa6c..410a99995 100644 --- a/libbb/read_key.c +++ b/libbb/read_key.c | |||
@@ -22,7 +22,6 @@ int64_t FAST_FUNC read_key(int fd, char *buffer) | |||
22 | 'O','B' |0x80,KEYCODE_DOWN , | 22 | 'O','B' |0x80,KEYCODE_DOWN , |
23 | 'O','C' |0x80,KEYCODE_RIGHT , | 23 | 'O','C' |0x80,KEYCODE_RIGHT , |
24 | 'O','D' |0x80,KEYCODE_LEFT , | 24 | 'O','D' |0x80,KEYCODE_LEFT , |
25 | /* Ctrl-<arrow>: ESC [ 1 ; 5 x, where x = A/B/C/D */ | ||
26 | 'O','H' |0x80,KEYCODE_HOME , | 25 | 'O','H' |0x80,KEYCODE_HOME , |
27 | 'O','F' |0x80,KEYCODE_END , | 26 | 'O','F' |0x80,KEYCODE_END , |
28 | #if 0 | 27 | #if 0 |
@@ -37,15 +36,26 @@ int64_t FAST_FUNC read_key(int fd, char *buffer) | |||
37 | '[','B' |0x80,KEYCODE_DOWN , | 36 | '[','B' |0x80,KEYCODE_DOWN , |
38 | '[','C' |0x80,KEYCODE_RIGHT , | 37 | '[','C' |0x80,KEYCODE_RIGHT , |
39 | '[','D' |0x80,KEYCODE_LEFT , | 38 | '[','D' |0x80,KEYCODE_LEFT , |
39 | /* ESC [ 1 ; 2 x, where x = A/B/C/D: Shift-<arrow> */ | ||
40 | /* ESC [ 1 ; 3 x, where x = A/B/C/D: Alt-<arrow> */ | ||
41 | /* ESC [ 1 ; 4 x, where x = A/B/C/D: Alt-Shift-<arrow> */ | ||
42 | /* ESC [ 1 ; 5 x, where x = A/B/C/D: Ctrl-<arrow> - implemented below */ | ||
43 | /* ESC [ 1 ; 6 x, where x = A/B/C/D: Ctrl-Shift-<arrow> */ | ||
40 | '[','H' |0x80,KEYCODE_HOME , /* xterm */ | 44 | '[','H' |0x80,KEYCODE_HOME , /* xterm */ |
41 | /* [ESC] ESC [ [2] H - [Alt-][Shift-]Home */ | 45 | /* [ESC] ESC [ [2] H - [Alt-][Shift-]Home */ |
42 | '[','F' |0x80,KEYCODE_END , /* xterm */ | 46 | '[','F' |0x80,KEYCODE_END , /* xterm */ |
43 | '[','1','~' |0x80,KEYCODE_HOME , /* vt100? linux vt? or what? */ | 47 | '[','1','~' |0x80,KEYCODE_HOME , /* vt100? linux vt? or what? */ |
44 | '[','2','~' |0x80,KEYCODE_INSERT , | 48 | '[','2','~' |0x80,KEYCODE_INSERT , |
49 | /* ESC [ 2 ; 3 ~ - Alt-Insert */ | ||
45 | '[','3','~' |0x80,KEYCODE_DELETE , | 50 | '[','3','~' |0x80,KEYCODE_DELETE , |
46 | /* [ESC] ESC [ 3 [;2] ~ - [Alt-][Shift-]Delete */ | 51 | /* [ESC] ESC [ 3 [;2] ~ - [Alt-][Shift-]Delete */ |
52 | /* ESC [ 3 ; 3 ~ - Alt-Delete */ | ||
53 | /* ESC [ 3 ; 5 ~ - Ctrl-Delete */ | ||
47 | '[','4','~' |0x80,KEYCODE_END , /* vt100? linux vt? or what? */ | 54 | '[','4','~' |0x80,KEYCODE_END , /* vt100? linux vt? or what? */ |
48 | '[','5','~' |0x80,KEYCODE_PAGEUP , | 55 | '[','5','~' |0x80,KEYCODE_PAGEUP , |
56 | /* ESC [ 5 ; 3 ~ - Alt-PgUp */ | ||
57 | /* ESC [ 5 ; 5 ~ - Ctrl-PgUp */ | ||
58 | /* ESC [ 5 ; 7 ~ - Ctrl-Alt-PgUp */ | ||
49 | '[','6','~' |0x80,KEYCODE_PAGEDOWN, | 59 | '[','6','~' |0x80,KEYCODE_PAGEDOWN, |
50 | '[','7','~' |0x80,KEYCODE_HOME , /* vt100? linux vt? or what? */ | 60 | '[','7','~' |0x80,KEYCODE_HOME , /* vt100? linux vt? or what? */ |
51 | '[','8','~' |0x80,KEYCODE_END , /* vt100? linux vt? or what? */ | 61 | '[','8','~' |0x80,KEYCODE_END , /* vt100? linux vt? or what? */ |
@@ -64,6 +74,10 @@ int64_t FAST_FUNC read_key(int fd, char *buffer) | |||
64 | '[','2','3','~'|0x80,KEYCODE_FUN11 , | 74 | '[','2','3','~'|0x80,KEYCODE_FUN11 , |
65 | '[','2','4','~'|0x80,KEYCODE_FUN12 , | 75 | '[','2','4','~'|0x80,KEYCODE_FUN12 , |
66 | #endif | 76 | #endif |
77 | '[','1',';','5','A' |0x80,KEYCODE_CTRL_UP , | ||
78 | '[','1',';','5','B' |0x80,KEYCODE_CTRL_DOWN , | ||
79 | '[','1',';','5','C' |0x80,KEYCODE_CTRL_RIGHT, | ||
80 | '[','1',';','5','D' |0x80,KEYCODE_CTRL_LEFT , | ||
67 | 0 | 81 | 0 |
68 | }; | 82 | }; |
69 | 83 | ||