input: support backtab when Slang and/or --rebindkeypad is used

The escape sequence "Esc [ Z" is a backtab on most supported terminals,
so make sure convert_sequence() treats it as such.
This commit is contained in:
David Lawrence Ramsey 2017-12-12 14:43:03 -06:00 committed by Benno Schulenberg
parent 08e9d30fa2
commit f66432e999
3 changed files with 11 additions and 8 deletions

View File

@ -1147,9 +1147,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0);
add_to_sclist(MMAIN, "M-}", 0, do_indent, 0);
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
#ifdef KEY_BTAB
add_to_sclist(MMAIN, "S-Tab", KEY_BTAB, do_unindent, 0);
#endif
add_to_sclist(MMAIN, "S-Tab", SHIFT_TAB, do_unindent, 0);
add_to_sclist(MMAIN, "M-:", 0, record_macro, 0);
add_to_sclist(MMAIN, "M-;", 0, run_macro, 0);
add_to_sclist(MMAIN, "M-U", 0, do_undo, 0);

View File

@ -590,6 +590,7 @@ enum
#define SHIFT_END 0x456
#define SHIFT_PAGEUP 0x457
#define SHIFT_PAGEDOWN 0x458
#define SHIFT_TAB 0x45F
#ifdef USE_SLANG
#ifdef ENABLE_UTF8

View File

@ -613,11 +613,9 @@ int parse_kbinput(WINDOW *win)
#ifndef NANO_TINY
/* Is Shift being held? */
if (modifiers & 0x01) {
#ifdef KEY_BTAB
/* A shifted <Tab> is a back tab. */
if (retval == TAB_CODE)
return KEY_BTAB;
#endif
return SHIFT_TAB;
shift_held = TRUE;
}
#endif
@ -769,6 +767,11 @@ int parse_kbinput(WINDOW *win)
case KEY_SUSPEND:
return the_code_for(do_suspend_void, KEY_SUSPEND);
#endif
#ifdef KEY_BTAB
/* Slang doesn't support KEY_BTAB. */
case KEY_BTAB:
return SHIFT_TAB;
#endif
#ifdef PDCURSES
case KEY_SHIFT_L:
case KEY_SHIFT_R:
@ -1213,8 +1216,9 @@ int convert_sequence(const int *seq, size_t seq_len)
return KEY_F(12);
case 'Y': /* Esc [ Y == End on Mach console. */
return KEY_END;
case 'Z': /* Esc [ Z == F14 on FreeBSD console. */
return KEY_F(14);
case 'Z': /* Esc [ Z == Shift-Tab on ANSI/Linux console/
* FreeBSD console/xterm/rxvt/Terminal. */
return SHIFT_TAB;
case 'a': /* Esc [ a == Shift-Up on rxvt/Eterm. */
case 'b': /* Esc [ b == Shift-Down on rxvt/Eterm. */
case 'c': /* Esc [ c == Shift-Right on rxvt/Eterm. */