2014-06-29 Benno Schulenberg <bensberg@justemail.net>
* src/rcfile.c: Fix compilation with --enable-tiny --enable-nanorc.
+ * src/winio.c (parse_kbinput, get_escape_seq_kbinput): Make Ctrl-Left
+ and Ctrl-Right produce special codes, and map these codes to Prevword
+ and Nextword instead of reducing them to a plain Left and Right. The
+ codes 539 and 554 were so chosen because some terminals produce these.
2014-06-29 Mark Majeres <mark@engine12.com>
* src/text.c (do_undo): Update the pointer to the bottom of the file
#define NANO_CONTROL_7 31
#define NANO_CONTROL_8 127
+/* Codes for "modified" Arrow keys. Chosen like this because some
+ * terminals produce them, and they are beyond KEY_MAX of ncurses. */
+#define CONTROL_LEFT 539
+#define CONTROL_RIGHT 554
#ifndef NANO_TINY
/* Extra bits for the undo function. */
retval = ERR;
break;
#endif
+ case CONTROL_LEFT:
+#ifndef NANO_TINY
+ retval = sc_seq_or(do_prev_word_void, 0);
+#endif
+ break;
+ case CONTROL_RIGHT:
+#ifndef NANO_TINY
+ retval = sc_seq_or(do_next_word_void, 0);
+#endif
+ break;
}
/* If our result is an extended keypad value (i.e. a value
* Terminal. */
case 'B': /* Esc O 1 ; 5 B == Ctrl-Down on
* Terminal. */
+ retval = get_escape_seq_abcd(seq[4]);
+ break;
case 'C': /* Esc O 1 ; 5 C == Ctrl-Right on
* Terminal. */
+ retval = CONTROL_RIGHT;
+ break;
case 'D': /* Esc O 1 ; 5 D == Ctrl-Left on
* Terminal. */
- retval = get_escape_seq_abcd(seq[4]);
+ retval = CONTROL_LEFT;
break;
}
}
break;
case 'a': /* Esc O a == Ctrl-Up on rxvt. */
case 'b': /* Esc O b == Ctrl-Down on rxvt. */
+ retval = get_escape_seq_abcd(seq[1]);
+ break;
case 'c': /* Esc O c == Ctrl-Right on rxvt. */
+ retval = CONTROL_RIGHT;
+ break;
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
- retval = get_escape_seq_abcd(seq[1]);
+ retval = CONTROL_LEFT;
break;
case 'j': /* Esc O j == '*' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
switch (seq[1]) {
case 'a': /* Esc o a == Ctrl-Up on Eterm. */
case 'b': /* Esc o b == Ctrl-Down on Eterm. */
+ retval = get_escape_seq_abcd(seq[1]);
+ break;
case 'c': /* Esc o c == Ctrl-Right on Eterm. */
+ retval = CONTROL_RIGHT;
+ break;
case 'd': /* Esc o d == Ctrl-Left on Eterm. */
- retval = get_escape_seq_abcd(seq[1]);
+ retval = CONTROL_LEFT;
break;
}
break;
* xterm. */
case 'B': /* Esc [ 1 ; 5 B == Ctrl-Down on
* xterm. */
+ retval = get_escape_seq_abcd(seq[4]);
+ break;
case 'C': /* Esc [ 1 ; 5 C == Ctrl-Right on
* xterm. */
+ retval = CONTROL_RIGHT;
+ break;
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on
* xterm. */
- retval = get_escape_seq_abcd(seq[4]);
+ retval = CONTROL_LEFT;
break;
}
}