input: neutralize two spurious keycodes from VTE terminals
At least some of the VTE-based terminals claim to be compatible with xterm-25color (and set TERM to that value). But they really aren't: they mishandle the focus-in and focus-out events, for example. So, catch and discard the corresponding keycodes that nano shouldn't be seeing at all. This improves the fix for https://savannah.gnu.org/bugs/?64578.
This commit is contained in:
parent
8804b6dcd4
commit
ef35ea72cf
@ -214,6 +214,9 @@
|
|||||||
#define SHIFT_DELETE 0x45D
|
#define SHIFT_DELETE 0x45D
|
||||||
#define SHIFT_TAB 0x45F
|
#define SHIFT_TAB 0x45F
|
||||||
|
|
||||||
|
#define FOCUS_IN 0x491
|
||||||
|
#define FOCUS_OUT 0x499
|
||||||
|
|
||||||
/* Special keycodes for when a string bind has been partially implanted
|
/* Special keycodes for when a string bind has been partially implanted
|
||||||
* or has an unpaired opening brace, or when a function in a string bind
|
* or has an unpaired opening brace, or when a function in a string bind
|
||||||
* needs execution or a specified function name is invalid. */
|
* needs execution or a specified function name is invalid. */
|
||||||
|
|||||||
@ -107,6 +107,7 @@ int altpageup, altpagedown;
|
|||||||
int altinsert, altdelete;
|
int altinsert, altdelete;
|
||||||
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
||||||
#endif
|
#endif
|
||||||
|
int mousefocusin, mousefocusout;
|
||||||
|
|
||||||
#ifdef ENABLED_WRAPORJUSTIFY
|
#ifdef ENABLED_WRAPORJUSTIFY
|
||||||
ssize_t fill = -COLUMNS_FROM_EOL;
|
ssize_t fill = -COLUMNS_FROM_EOL;
|
||||||
|
|||||||
@ -2426,6 +2426,8 @@ int main(int argc, char **argv)
|
|||||||
shiftaltup = get_keycode("kUP4", SHIFT_ALT_UP);
|
shiftaltup = get_keycode("kUP4", SHIFT_ALT_UP);
|
||||||
shiftaltdown = get_keycode("kDN4", SHIFT_ALT_DOWN);
|
shiftaltdown = get_keycode("kDN4", SHIFT_ALT_DOWN);
|
||||||
#endif
|
#endif
|
||||||
|
mousefocusin = get_keycode("kxIN", FOCUS_IN);
|
||||||
|
mousefocusout = get_keycode("kxOUT", FOCUS_OUT);
|
||||||
|
|
||||||
#ifdef HAVE_SET_ESCDELAY
|
#ifdef HAVE_SET_ESCDELAY
|
||||||
/* Tell ncurses to pass the Esc key quickly. */
|
/* Tell ncurses to pass the Esc key quickly. */
|
||||||
|
|||||||
@ -80,6 +80,7 @@ extern int altinsert, altdelete;
|
|||||||
extern int shiftaltleft, shiftaltright;
|
extern int shiftaltleft, shiftaltright;
|
||||||
extern int shiftaltup, shiftaltdown;
|
extern int shiftaltup, shiftaltdown;
|
||||||
#endif
|
#endif
|
||||||
|
extern int mousefocusin, mousefocusout;
|
||||||
|
|
||||||
#ifdef ENABLED_WRAPORJUSTIFY
|
#ifdef ENABLED_WRAPORJUSTIFY
|
||||||
extern ssize_t fill;
|
extern ssize_t fill;
|
||||||
|
|||||||
@ -1245,6 +1245,10 @@ int parse_kbinput(WINDOW *frame)
|
|||||||
return INDENT_KEY;
|
return INDENT_KEY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Spurious codes from VTE -- see https://sv.gnu.org/bugs/?64578. */
|
||||||
|
if (keycode == mousefocusin || keycode == mousefocusout)
|
||||||
|
return ERR;
|
||||||
|
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case KEY_SLEFT:
|
case KEY_SLEFT:
|
||||||
shift_held = TRUE;
|
shift_held = TRUE;
|
||||||
@ -1320,11 +1324,6 @@ int parse_kbinput(WINDOW *frame)
|
|||||||
case KEY_BTAB:
|
case KEY_BTAB:
|
||||||
return SHIFT_TAB;
|
return SHIFT_TAB;
|
||||||
|
|
||||||
case 0x24C: /* Spurious code from VTE -- see https://sv.gnu.org/bugs/?64578. */
|
|
||||||
statusline(ALERT, _("Wrong TERM for this terminal"));
|
|
||||||
place_the_cursor();
|
|
||||||
return ERR;
|
|
||||||
|
|
||||||
case KEY_SBEG:
|
case KEY_SBEG:
|
||||||
case KEY_BEG:
|
case KEY_BEG:
|
||||||
case KEY_B2: /* Center (5) on keypad with NumLock off. */
|
case KEY_B2: /* Center (5) on keypad with NumLock off. */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user