diff --git a/doc/syntax/nanorc.nanorc b/doc/syntax/nanorc.nanorc index 3d2e353..11bcf00 100644 --- a/doc/syntax/nanorc.nanorc +++ b/doc/syntax/nanorc.nanorc @@ -12,6 +12,8 @@ icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|t icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+" icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" +icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^)(Up|Down|Right|Left|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" +icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^)(Up|Down|Right|Left|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)" icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|linter|formatter)[[:space:]]+.*$" icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|formatter|extendsyntax)\>" diff --git a/src/global.c b/src/global.c index da404d2..0ec7f34 100644 --- a/src/global.c +++ b/src/global.c @@ -410,6 +410,14 @@ void assign_keyinfo(sc *s, const char *keystring) s->keycode = keystring[1] - 64; if (strcasecmp(keystring, "^Space") == 0) s->keycode = 0; + else if (!strcasecmp(keystring, "^Up")) + s->keycode = CONTROL_UP; + else if (!strcasecmp(keystring, "^Down")) + s->keycode = CONTROL_DOWN; + else if (!strcasecmp(keystring, "^Left")) + s->keycode = CONTROL_LEFT; + else if (!strcasecmp(keystring, "^Right")) + s->keycode = CONTROL_RIGHT; } else if (s->meta) { s->keycode = tolower((int)keystring[2]); if (strcasecmp(keystring, "M-Space") == 0) @@ -1116,6 +1124,8 @@ void shortcut_init(void) add_to_sclist(MMOST, "^F", do_right, 0); add_to_sclist(MMOST, "Right", do_right, 0); #ifndef NANO_TINY + add_to_sclist(MMAIN, "^Left", do_prev_word_void, 0); + add_to_sclist(MMAIN, "^Right", do_next_word_void, 0); add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0); add_to_sclist(MMOST, "^Space", do_next_word_void, 0); #endif @@ -1130,6 +1140,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/winio.c b/src/winio.c index 13ae8ca..26db25e 100644 --- a/src/winio.c +++ b/src/winio.c @@ -497,13 +497,13 @@ int parse_kbinput(WINDOW *win) #ifndef NANO_TINY if (retval == controlleft) - return sc_seq_or(do_prev_word_void, 0); + return CONTROL_LEFT; else if (retval == controlright) - return sc_seq_or(do_next_word_void, 0); + return CONTROL_RIGHT; else if (retval == controlup) - return sc_seq_or(do_prev_block, 0); + return CONTROL_UP; else if (retval == controldown) - return sc_seq_or(do_next_block, 0); + return CONTROL_DOWN; #endif #if defined(__linux__) && !defined(NANO_TINY)