* Escape sequence compatibility:
*
* We support escape sequences for ANSI, VT100, VT220, VT320, the Linux
- * console, the FreeBSD console, the Mach console, xterm, rxvt, and
- * Eterm. Among these, there are several conflicts and omissions,
- * outlined as follows:
+ * console, the FreeBSD console, the Mach console, xterm, rxvt, Eterm,
+ * and Terminal. Among these, there are several conflicts and
+ * omissions, outlined as follows:
*
* - Tab on ANSI == PageUp on FreeBSD console; the former is omitted.
* (Ctrl-I is also Tab on ANSI, which we already support.)
switch (seq[0]) {
case 'O':
switch (seq[1]) {
+ case '1':
+ if (seq_len >= 3) {
+ switch (seq[2]) {
+ case ';':
+ if (seq_len >= 4) {
+ switch (seq[3]) {
+ case '2':
+ if (seq_len >= 5) {
+ switch (seq[4]) {
+ case 'A': /* Esc O 1 ; 2 A == Shift-Up on
+ * Terminal. */
+ case 'B': /* Esc O 1 ; 2 B == Shift-Down on
+ * Terminal. */
+ case 'C': /* Esc O 1 ; 2 C == Shift-Right on
+ * Terminal. */
+ case 'D': /* Esc O 1 ; 2 D == Shift-Left on
+ * Terminal. */
+ retval = get_escape_seq_abcd(seq[4]);
+ break;
+ case 'P': /* Esc O 1 ; 2 P == F13 on
+ * Terminal. */
+ retval = KEY_F(13);
+ break;
+ case 'Q': /* Esc O 1 ; 2 Q == F14 on
+ * Terminal. */
+ retval = KEY_F(14);
+ break;
+ case 'R': /* Esc O 1 ; 2 R == F15 on
+ * Terminal. */
+ retval = KEY_F(15);
+ break;
+ case 'S': /* Esc O 1 ; 2 S == F16 on
+ * Terminal. */
+ retval = KEY_F(16);
+ break;
+ }
+ }
+ break;
+ case '5':
+ if (seq_len >= 5) {
+ switch (seq[4]) {
+ case 'A': /* Esc O 1 ; 5 A == Ctrl-Up on
+ * Terminal. */
+ case 'B': /* Esc O 1 ; 5 B == Ctrl-Down on
+ * Terminal. */
+ case 'C': /* Esc O 1 ; 5 C == Ctrl-Right on
+ * Terminal. */
+ case 'D': /* Esc O 1 ; 5 D == Ctrl-Left on
+ * Terminal. */
+ retval = get_escape_seq_abcd(seq[4]);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ break;
case '2':
if (seq_len >= 3) {
switch (seq[2]) {
* with NumLock off on xterm. */
retval = KEY_B2;
break;
- case 'F': /* Esc O F == End on xterm. */
+ case 'F': /* Esc O F == End on xterm/Terminal. */
retval = NANO_END_KEY;
break;
- case 'H': /* Esc O H == Home on xterm. */
+ case 'H': /* Esc O H == Home on xterm/Terminal. */
retval = NANO_HOME_KEY;
break;
case 'M': /* Esc O M == Enter on numeric keypad with
break;
case 'j': /* Esc O j == '*' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = '*';
break;
case 'k': /* Esc O k == '+' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = '+';
break;
case 'l': /* Esc O l == ',' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = ',';
break;
case 'm': /* Esc O m == '-' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = '-';
break;
case 'n': /* Esc O n == Delete (.) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
- * xterm/rxvt/Eterm. */
+ * xterm/rxvt/Eterm/Terminal. */
retval = NANO_DELETE_KEY;
break;
case 'o': /* Esc O o == '/' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = '/';
break;
case 'p': /* Esc O p == Insert (0) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = NANO_INSERTFILE_KEY;
break;
case 'q': /* Esc O q == End (1) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = NANO_END_KEY;
break;
case 'r': /* Esc O r == Down (2) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = NANO_NEXTLINE_KEY;
break;
case 's': /* Esc O s == PageDown (3) on numeric
* keypad with NumLock off on VT100/VT220/
- * VT320/rxvt/Eterm. */
+ * VT320/rxvt/Eterm/Terminal. */
retval = NANO_NEXTPAGE_KEY;
break;
case 't': /* Esc O t == Left (4) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = NANO_BACK_KEY;
break;
case 'u': /* Esc O u == Center (5) on numeric keypad
break;
case 'v': /* Esc O v == Right (6) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = NANO_FORWARD_KEY;
break;
case 'w': /* Esc O w == Home (7) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = NANO_HOME_KEY;
break;
case 'x': /* Esc O x == Up (8) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = NANO_PREVLINE_KEY;
break;
case 'y': /* Esc O y == PageUp (9) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
- * rxvt/Eterm. */
+ * rxvt/Eterm/Terminal. */
retval = NANO_PREVPAGE_KEY;
break;
}
break;
default: /* Esc [ 2 ~ == Insert on
* VT220/VT320/Linux console/
- * xterm. */
+ * xterm/Terminal. */
retval = NANO_INSERTFILE_KEY;
break;
}
}
break;
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
- * Linux console/xterm. */
+ * Linux console/xterm/Terminal. */
retval = NANO_DELETE_KEY;
break;
case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux
retval = NANO_END_KEY;
break;
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
- * Linux console/xterm; Esc [ 5 ^ ==
- * PageUp on Eterm. */
+ * Linux console/xterm/Terminal;
+ * Esc [ 5 ^ == PageUp on Eterm. */
retval = NANO_PREVPAGE_KEY;
break;
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
- * Linux console/xterm; Esc [ 6 ^ ==
- * PageDown on Eterm. */
+ * Linux console/xterm/Terminal;
+ * Esc [ 6 ^ == PageDown on Eterm. */
retval = NANO_NEXTPAGE_KEY;
break;
case '7': /* Esc [ 7 ~ == Home on rxvt. */
retval = get_escape_seq_abcd(seq[1]);
break;
case 'E': /* Esc [ E == Center (5) on numeric keypad
- * with NumLock off on FreeBSD console. */
+ * with NumLock off on FreeBSD console/
+ * Terminal. */
retval = KEY_B2;
break;
case 'F': /* Esc [ F == End on FreeBSD