input: keep the Ctrl+Arrow keys working when their synonyms are unbound

This fixes https://savannah.gnu.org/bugs/?49058 reported by Rishabh Dave.
master
Benno Schulenberg 2016-10-11 10:50:04 +02:00
parent 00efa50385
commit fdee0df849
2 changed files with 18 additions and 5 deletions

View File

@ -410,9 +410,18 @@ void assign_keyinfo(sc *s, const char *keystring)
assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2)); assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2));
if (keystring[0] == '^') { if (keystring[0] == '^') {
s->keycode = keystring[1] - 64;
if (strcasecmp(keystring, "^Space") == 0) if (strcasecmp(keystring, "^Space") == 0)
s->keycode = 0; s->keycode = 0;
else if (strcasecmp(keystring, "^Left") == 0)
s->keycode = CONTROL_LEFT;
else if (strcasecmp(keystring, "^Right") == 0)
s->keycode = CONTROL_RIGHT;
else if (strcasecmp(keystring, "^Up") == 0)
s->keycode = CONTROL_UP;
else if (strcasecmp(keystring, "^Down") == 0)
s->keycode = CONTROL_DOWN;
else
s->keycode = keystring[1] - 64;
} else if (s->meta) { } else if (s->meta) {
s->keycode = tolower((int)keystring[2]); s->keycode = tolower((int)keystring[2]);
if (strcasecmp(keystring, "M-Space") == 0) if (strcasecmp(keystring, "M-Space") == 0)
@ -1113,6 +1122,8 @@ void shortcut_init(void)
add_to_sclist(MMOST, "Left", do_left, 0); add_to_sclist(MMOST, "Left", do_left, 0);
add_to_sclist(MMOST, "^F", do_right, 0); add_to_sclist(MMOST, "^F", do_right, 0);
add_to_sclist(MMOST, "Right", do_right, 0); add_to_sclist(MMOST, "Right", do_right, 0);
add_to_sclist(MMOST, "^Left", do_prev_word_void, 0);
add_to_sclist(MMOST, "^Right", do_next_word_void, 0);
add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0); add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0);
add_to_sclist(MMOST, "^Space", do_next_word_void, 0); add_to_sclist(MMOST, "^Space", do_next_word_void, 0);
add_to_sclist((MMOST & ~MBROWSER), "^A", do_home, 0); add_to_sclist((MMOST & ~MBROWSER), "^A", do_home, 0);
@ -1123,6 +1134,8 @@ void shortcut_init(void)
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", do_up_void, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", do_up_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", do_down_void, 0); add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", do_down_void, 0);
add_to_sclist(MMAIN, "^Up", do_prev_block, 0);
add_to_sclist(MMAIN, "^Down", do_next_block, 0);
add_to_sclist(MMAIN, "M-7", do_prev_block, 0); add_to_sclist(MMAIN, "M-7", do_prev_block, 0);
add_to_sclist(MMAIN, "M-8", do_next_block, 0); add_to_sclist(MMAIN, "M-8", do_next_block, 0);
#ifndef DISABLE_JUSTIFY #ifndef DISABLE_JUSTIFY

View File

@ -495,13 +495,13 @@ int parse_kbinput(WINDOW *win)
return ERR; return ERR;
if (retval == controlleft) if (retval == controlleft)
return sc_seq_or(do_prev_word_void, controlleft); return CONTROL_LEFT;
else if (retval == controlright) else if (retval == controlright)
return sc_seq_or(do_next_word_void, controlright); return CONTROL_RIGHT;
else if (retval == controlup) else if (retval == controlup)
return sc_seq_or(do_prev_block, controlup); return CONTROL_UP;
else if (retval == controldown) else if (retval == controldown)
return sc_seq_or(do_next_block, controldown); return CONTROL_DOWN;
#ifndef NANO_TINY #ifndef NANO_TINY
else if (retval == shiftcontrolleft) { else if (retval == shiftcontrolleft) {
shift_held = TRUE; shift_held = TRUE;