diff --git a/src/global.c b/src/global.c index 191b38e..6f435ad 100644 --- a/src/global.c +++ b/src/global.c @@ -414,6 +414,18 @@ void assign_keyinfo(sc *s, const char *keystring) s->keycode = (int)' '; } else if (keystring[0] == 'F') s->keycode = KEY_F0 + atoi(&keystring[1]); +#ifndef NANO_TINY + /* Handle some special combinations, where combination is more than + * a pair of characters. */ + if (!strcasecmp(s->keystr, "^Left")) + s->keycode = 544; + else if (!strcasecmp(s->keystr, "^Right")) + s->keycode = 559; + else if (!strcasecmp(s->keystr, "^Down")) + s->keycode = 524; + else if (!strcasecmp(s->keystr, "^Up")) + s->keycode = 565; +#endif /* Catch the strings that don't bind as easily as we'd like. */ else if (!strcasecmp(keystring, "Up")) s->keycode = KEY_UP; @@ -1116,6 +1128,8 @@ void shortcut_init(void) #ifndef NANO_TINY add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0); add_to_sclist(MMOST, "^Space", do_next_word_void, 0); + add_to_sclist(MMAIN, "^Left", do_prev_word_void, 0); + add_to_sclist(MMAIN, "^Right", do_next_word_void, 0); #endif add_to_sclist((MMOST & ~MBROWSER), "^A", do_home, 0); add_to_sclist((MMOST & ~MBROWSER), "Home", do_home, 0); @@ -1128,6 +1142,8 @@ void shortcut_init(void) #ifndef NANO_TINY add_to_sclist(MMAIN, "M-7", do_prev_block, 0); add_to_sclist(MMAIN, "M-8", do_next_block, 0); + add_to_sclist(MMAIN, "^Up", do_prev_block, 0); + add_to_sclist(MMAIN, "^Down", do_next_block, 0); #endif #ifndef DISABLE_JUSTIFY add_to_sclist(MMAIN, "M-(", do_para_begin_void, 0); diff --git a/src/rcfile.c b/src/rcfile.c index c900cb9..d8e29f6 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -496,6 +496,13 @@ void parse_binding(char *ptr, bool dobind) } if (dobind) { + /* Find same function in sclist and assign same toggle value + * to new shortcut. */ + if (first_sc_for(currmenu, newsc->scfunc) != NULL) + newsc->toggle = first_sc_for(currmenu, newsc->scfunc)->toggle; + else + newsc->toggle = 0; + /* If this is a toggle, copy its sequence number. */ if (newsc->scfunc == do_toggle_void) { for (s = sclist; s != NULL; s = s->next) diff --git a/src/winio.c b/src/winio.c index b8e7e99..442420e 100644 --- a/src/winio.c +++ b/src/winio.c @@ -392,14 +392,6 @@ int parse_kbinput(WINDOW *win) case 'B': retval = KEY_END; break; -#ifndef NANO_TINY - case 'C': - retval = controlright; - break; - case 'D': - retval = controlleft; - break; -#endif } double_esc = FALSE; escapes = 0; @@ -489,17 +481,6 @@ int parse_kbinput(WINDOW *win) if (retval == ERR) return ERR; -#ifndef NANO_TINY - if (retval == controlleft) - return sc_seq_or(do_prev_word_void, 0); - else if (retval == controlright) - return sc_seq_or(do_next_word_void, 0); - else if (retval == controlup) - return sc_seq_or(do_prev_block, 0); - else if (retval == controldown) - return sc_seq_or(do_next_block, 0); -#endif - switch (retval) { #ifdef KEY_SLEFT /* Slang doesn't support KEY_SLEFT. */