1
1

in get_escape_seq_kbinput(), add escape sequences for Terminal

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4067 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
David Lawrence Ramsey 2007-04-04 20:36:56 +00:00
родитель a2c4704abb
Коммит 267daeb381
2 изменённых файлов: 90 добавлений и 27 удалений

Просмотреть файл

@ -1,6 +1,8 @@
2007-04-04 David Lawrence Ramsey <pooka109@gmail.com>
* AUTHORS, faq.html: Update email address.
* winio.c (get_escape_seq_kbinput): Add escape sequences for
Terminal.
2007-02-01 Benno Schulenberg <bensberg@justemail.net>

Просмотреть файл

@ -70,9 +70,9 @@ static bool disable_cursorpos = FALSE;
* 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.)
@ -681,6 +681,66 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
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]) {
@ -716,10 +776,10 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
* 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
@ -769,57 +829,57 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
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
@ -829,22 +889,22 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
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;
}
@ -989,14 +1049,14 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
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
@ -1004,13 +1064,13 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
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. */
@ -1040,7 +1100,8 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
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