diff options
author | Denys Vlasenko | 2009-10-25 23:50:56 +0100 |
---|---|---|
committer | Denys Vlasenko | 2009-10-25 23:50:56 +0100 |
commit | a17eeb847e66824c4d389751cc90415d3fc1c5a3 (patch) | |
tree | a5dd027573c002641942191f8ae1f7c7b1f7429e /libbb/read_key.c | |
parent | 77c066ea5cf4b1ee606a81e48388ff0b1d019134 (diff) | |
download | busybox-a17eeb847e66824c4d389751cc90415d3fc1c5a3.zip busybox-a17eeb847e66824c4d389751cc90415d3fc1c5a3.tar.gz |
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 d3832fa..410a999 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) 'O','B' |0x80,KEYCODE_DOWN , 'O','C' |0x80,KEYCODE_RIGHT , 'O','D' |0x80,KEYCODE_LEFT , - /* Ctrl-<arrow>: ESC [ 1 ; 5 x, where x = A/B/C/D */ 'O','H' |0x80,KEYCODE_HOME , 'O','F' |0x80,KEYCODE_END , #if 0 @@ -37,15 +36,26 @@ int64_t FAST_FUNC read_key(int fd, char *buffer) '[','B' |0x80,KEYCODE_DOWN , '[','C' |0x80,KEYCODE_RIGHT , '[','D' |0x80,KEYCODE_LEFT , + /* ESC [ 1 ; 2 x, where x = A/B/C/D: Shift-<arrow> */ + /* ESC [ 1 ; 3 x, where x = A/B/C/D: Alt-<arrow> */ + /* ESC [ 1 ; 4 x, where x = A/B/C/D: Alt-Shift-<arrow> */ + /* ESC [ 1 ; 5 x, where x = A/B/C/D: Ctrl-<arrow> - implemented below */ + /* ESC [ 1 ; 6 x, where x = A/B/C/D: Ctrl-Shift-<arrow> */ '[','H' |0x80,KEYCODE_HOME , /* xterm */ /* [ESC] ESC [ [2] H - [Alt-][Shift-]Home */ '[','F' |0x80,KEYCODE_END , /* xterm */ '[','1','~' |0x80,KEYCODE_HOME , /* vt100? linux vt? or what? */ '[','2','~' |0x80,KEYCODE_INSERT , + /* ESC [ 2 ; 3 ~ - Alt-Insert */ '[','3','~' |0x80,KEYCODE_DELETE , /* [ESC] ESC [ 3 [;2] ~ - [Alt-][Shift-]Delete */ + /* ESC [ 3 ; 3 ~ - Alt-Delete */ + /* ESC [ 3 ; 5 ~ - Ctrl-Delete */ '[','4','~' |0x80,KEYCODE_END , /* vt100? linux vt? or what? */ '[','5','~' |0x80,KEYCODE_PAGEUP , + /* ESC [ 5 ; 3 ~ - Alt-PgUp */ + /* ESC [ 5 ; 5 ~ - Ctrl-PgUp */ + /* ESC [ 5 ; 7 ~ - Ctrl-Alt-PgUp */ '[','6','~' |0x80,KEYCODE_PAGEDOWN, '[','7','~' |0x80,KEYCODE_HOME , /* vt100? linux vt? or what? */ '[','8','~' |0x80,KEYCODE_END , /* vt100? linux vt? or what? */ @@ -64,6 +74,10 @@ int64_t FAST_FUNC read_key(int fd, char *buffer) '[','2','3','~'|0x80,KEYCODE_FUN11 , '[','2','4','~'|0x80,KEYCODE_FUN12 , #endif + '[','1',';','5','A' |0x80,KEYCODE_CTRL_UP , + '[','1',';','5','B' |0x80,KEYCODE_CTRL_DOWN , + '[','1',';','5','C' |0x80,KEYCODE_CTRL_RIGHT, + '[','1',';','5','D' |0x80,KEYCODE_CTRL_LEFT , 0 }; |