mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 12:31:45 +08:00
Add support for Ctrl+Right and Ctrl+Left, forward/back word
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
2ce0be942e
commit
0bfaf351aa
@ -930,6 +930,20 @@ static el_status_t meta(void)
|
|||||||
if (c == '[' || c == 'O') {
|
if (c == '[' || c == 'O') {
|
||||||
switch (tty_get()) {
|
switch (tty_get()) {
|
||||||
case EOF: return CSeof;
|
case EOF: return CSeof;
|
||||||
|
case '1':
|
||||||
|
{
|
||||||
|
char seq[4] = { 0 };
|
||||||
|
|
||||||
|
for (c = 0; c < 3; c++)
|
||||||
|
seq[c] = tty_get();
|
||||||
|
|
||||||
|
if (!strncmp(seq, ";5C", 3))
|
||||||
|
return fd_word(); /* Ctrl+Right */
|
||||||
|
if (!strncmp(seq, ";5D", 3))
|
||||||
|
return bk_word(); /* Ctrl+Left */
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case '2': tty_get(); return CSstay; /* Insert */
|
case '2': tty_get(); return CSstay; /* Insert */
|
||||||
case '3': tty_get(); return del_char(); /* Delete */
|
case '3': tty_get(); return del_char(); /* Delete */
|
||||||
case '5': tty_get(); return CSstay; /* PgUp */
|
case '5': tty_get(); return CSstay; /* PgUp */
|
||||||
|
Loading…
Reference in New Issue
Block a user