diff --git a/src/global.c b/src/global.c index e2d8749..e319719 100644 --- a/src/global.c +++ b/src/global.c @@ -429,6 +429,19 @@ void assign_keyinfo(sc *s) } else /* RAWINPUT */ s->seq = (int) s->keystr[0]; +#ifndef NANO_TINY + /* Handle some special combinations, where combination is more than + * a pair of characters. */ + if (!strcasecmp(s->keystr, "^Left")) + s->seq = 544; + else if (!strcasecmp(s->keystr, "^Right")) + s->seq = 559; + else if (!strcasecmp(s->keystr, "^Down")) + s->seq = 524; + else if (!strcasecmp(s->keystr, "^Up")) + s->seq = 565; +#endif + /* Override some keys which don't bind as easily as we'd like. */ if (s->type == CONTROL && (!strcasecmp(&s->keystr[1], "space"))) s->seq = 0; @@ -1137,6 +1150,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); @@ -1149,6 +1164,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 c46c361..92b1e8c 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -505,6 +505,11 @@ void parse_binding(char *ptr, bool dobind) newsc->ordinal = s->ordinal; } else newsc->ordinal = 0; + + /* Find same function in sclist and assign same toggle value + * to new shortcut. */ + newsc->toggle = first_sc_for(currmenu, newsc->scfunc)->toggle; + /* Add the new shortcut at the start of the list. */ newsc->next = sclist; sclist = newsc; diff --git a/src/winio.c b/src/winio.c index e5bbcaf..51221c1 100644 --- a/src/winio.c +++ b/src/winio.c @@ -395,14 +395,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; @@ -630,17 +622,6 @@ int parse_kbinput(WINDOW *win) #endif } -#ifndef NANO_TINY - if (retval == controlleft) - retval = sc_seq_or(do_prev_word_void, 0); - else if (retval == controlright) - retval = sc_seq_or(do_next_word_void, 0); - else if (retval == controlup) - retval = sc_seq_or(do_prev_block, 0); - else if (retval == controldown) - retval = sc_seq_or(do_next_block, 0); -#endif - /* If our result is an extended keypad value (i.e. a value * outside of byte range), set func_key to TRUE. */ if (retval != ERR)