input: make Shift+Alt+Arrow work properly on rxvt and Eterm terminals
This fixes https://savannah.gnu.org/bugs/?49636.master
parent
eb68cd1c6b
commit
059c8efb44
30
src/winio.c
30
src/winio.c
|
@ -391,7 +391,8 @@ int parse_kbinput(WINDOW *win)
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (double_esc) {
|
if (double_esc) {
|
||||||
/* An "ESC ESC [ X" sequence from Option+arrow. */
|
/* An "ESC ESC [ X" sequence from Option+arrow, or
|
||||||
|
* an "ESC ESC [ x" sequence from Shift+Alt+arrow. */
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case 'A':
|
case 'A':
|
||||||
retval = KEY_HOME;
|
retval = KEY_HOME;
|
||||||
|
@ -405,6 +406,18 @@ int parse_kbinput(WINDOW *win)
|
||||||
case 'D':
|
case 'D':
|
||||||
retval = controlleft;
|
retval = controlleft;
|
||||||
break;
|
break;
|
||||||
|
case 'a':
|
||||||
|
retval = shiftaltup;
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
retval = shiftaltdown;
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
retval = shiftaltright;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
retval = shiftaltleft;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
double_esc = FALSE;
|
double_esc = FALSE;
|
||||||
escapes = 0;
|
escapes = 0;
|
||||||
|
@ -464,8 +477,9 @@ int parse_kbinput(WINDOW *win)
|
||||||
escapes = 0;
|
escapes = 0;
|
||||||
}
|
}
|
||||||
} else if (keycode == '[' && key_buffer_len > 0 &&
|
} else if (keycode == '[' && key_buffer_len > 0 &&
|
||||||
'A' <= *key_buffer && *key_buffer <= 'D') {
|
(('A' <= *key_buffer && *key_buffer <= 'D') ||
|
||||||
/* This is an iTerm2 sequence: ^[ ^[ [ X. */
|
('a' <= *key_buffer && *key_buffer <= 'd'))) {
|
||||||
|
/* An iTerm2/Eterm/rxvt sequence: ^[ ^[ [ X. */
|
||||||
double_esc = TRUE;
|
double_esc = TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* Two escapes followed by a non-escape, and there are more
|
/* Two escapes followed by a non-escape, and there are more
|
||||||
|
@ -1432,10 +1446,10 @@ int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read in one control character (or an iTerm double Escape), or convert a
|
/* Read in one control character (or an iTerm/Eterm/rxvt double Escape),
|
||||||
* series of six digits into a Unicode codepoint. Return in count either 1
|
* or convert a series of six digits into a Unicode codepoint. Return
|
||||||
* (for a control character or the first byte of a multibyte sequence), or 2
|
* in count either 1 (for a control character or the first byte of a
|
||||||
* (for an iTerm double Escape). */
|
* multibyte sequence), or 2 (for an iTerm/Eterm/rxvt double Escape). */
|
||||||
int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||||
{
|
{
|
||||||
int *kbinput;
|
int *kbinput;
|
||||||
|
@ -1497,7 +1511,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||||
|
|
||||||
*count = 1;
|
*count = 1;
|
||||||
|
|
||||||
/* If this is an iTerm double escape, take both Escapes. */
|
/* If this is an iTerm/Eterm/rxvt double escape, take both Escapes. */
|
||||||
if (key_buffer_len > 3 && *key_buffer == ESC_CODE &&
|
if (key_buffer_len > 3 && *key_buffer == ESC_CODE &&
|
||||||
key_buffer[1] == ESC_CODE && key_buffer[2] == '[')
|
key_buffer[1] == ESC_CODE && key_buffer[2] == '[')
|
||||||
*count = 2;
|
*count = 2;
|
||||||
|
|
Loading…
Reference in New Issue