add minor comment fixes, and also fix a problem where the escape
sequence for F3 on the FreeBSD console wasn't interpreted properly git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1812 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
4e1a98c9c3
commit
973a96be62
|
@ -326,6 +326,8 @@ CVS code -
|
||||||
if a sequence is unrecognized, we will now return ERR and set
|
if a sequence is unrecognized, we will now return ERR and set
|
||||||
ignore_seq to FALSE. Also, here and elsewhere, don't bother
|
ignore_seq to FALSE. Also, here and elsewhere, don't bother
|
||||||
assigning ERR to retval when that's its initial value. (DLR)
|
assigning ERR to retval when that's its initial value. (DLR)
|
||||||
|
- Fix problem where the escape sequence for F3 on the FreeBSD
|
||||||
|
console would not be interpreted properly. (DLR)
|
||||||
get_mouseinput()
|
get_mouseinput()
|
||||||
- Don't ungetch() anything if there's no control key and no meta
|
- Don't ungetch() anything if there's no control key and no meta
|
||||||
key defined in the shortcut we clicked. (DLR)
|
key defined in the shortcut we clicked. (DLR)
|
||||||
|
|
175
src/winio.c
175
src/winio.c
|
@ -49,7 +49,7 @@ static int statblank = 0; /* Number of keystrokes left after
|
||||||
* - NANO_CONTROL_8 is Ctrl-8 (Ctrl-?), which is Delete under ASCII,
|
* - NANO_CONTROL_8 is Ctrl-8 (Ctrl-?), which is Delete under ASCII,
|
||||||
* ANSI, VT100, and VT220, and which is Backspace under VT320.
|
* ANSI, VT100, and VT220, and which is Backspace under VT320.
|
||||||
*
|
*
|
||||||
* Note: VT220s and VT320s also generate Esc [ 3 ~ for Delete. By
|
* Note: VT220 and VT320 also generate Esc [ 3 ~ for Delete. By
|
||||||
* default, xterm assumes it's running on a VT320 and generates Ctrl-8
|
* default, xterm assumes it's running on a VT320 and generates Ctrl-8
|
||||||
* (Ctrl-?) for Backspace and Esc [ 3 ~ for Delete. This causes
|
* (Ctrl-?) for Backspace and Esc [ 3 ~ for Delete. This causes
|
||||||
* problems for VT100-derived terminals such as the FreeBSD console,
|
* problems for VT100-derived terminals such as the FreeBSD console,
|
||||||
|
@ -85,8 +85,6 @@ static int statblank = 0; /* Number of keystrokes left after
|
||||||
* omitted. (Same as above.)
|
* omitted. (Same as above.)
|
||||||
* - F13 on FreeBSD console == End on Hurd console; the former is
|
* - F13 on FreeBSD console == End on Hurd console; the former is
|
||||||
* omitted. (Same as above.)
|
* omitted. (Same as above.)
|
||||||
* - The Hurd console has no escape sequences for F11, F12, F13, F14, or
|
|
||||||
* Center (5) on the numeric keypad with NumLock off.
|
|
||||||
*
|
*
|
||||||
* Note that Center (5) on the numeric keypad with NumLock off can also
|
* Note that Center (5) on the numeric keypad with NumLock off can also
|
||||||
* be the Begin key. */
|
* be the Begin key. */
|
||||||
|
@ -610,8 +608,8 @@ int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||||
retval = NANO_HOME_KEY;
|
retval = NANO_HOME_KEY;
|
||||||
break;
|
break;
|
||||||
case 'M': /* Esc O M == Enter on numeric keypad with
|
case 'M': /* Esc O M == Enter on numeric keypad with
|
||||||
* NumLock off on
|
* NumLock off on VT100/VT220/VT320/xterm/
|
||||||
* VT100/VT220/VT320/xterm/Eterm. */
|
* Eterm. */
|
||||||
retval = NANO_ENTER_KEY;
|
retval = NANO_ENTER_KEY;
|
||||||
break;
|
break;
|
||||||
case 'P': /* Esc O P == F1 on VT100/VT220/VT320/Hurd
|
case 'P': /* Esc O P == F1 on VT100/VT220/VT320/Hurd
|
||||||
|
@ -655,83 +653,83 @@ int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||||
retval = get_escape_seq_abcd(escape_seq[1]);
|
retval = get_escape_seq_abcd(escape_seq[1]);
|
||||||
break;
|
break;
|
||||||
case 'j': /* Esc O j == '*' on numeric keypad with
|
case 'j': /* Esc O j == '*' on numeric keypad with
|
||||||
* NumLock off on
|
* NumLock off on VT100/VT220/VT320/xterm/
|
||||||
* VT100/VT220/VT320/xterm/rxvt. */
|
* rxvt. */
|
||||||
retval = '*';
|
retval = '*';
|
||||||
break;
|
break;
|
||||||
case 'k': /* Esc O k == '+' on numeric keypad with
|
case 'k': /* Esc O k == '+' on numeric keypad with
|
||||||
* NumLock off on
|
* NumLock off on VT100/VT220/VT320/xterm/
|
||||||
* VT100/VT220/VT320/xterm/rxvt. */
|
* rxvt. */
|
||||||
retval = '+';
|
retval = '+';
|
||||||
break;
|
break;
|
||||||
case 'l': /* Esc O l == ',' on numeric keypad with
|
case 'l': /* Esc O l == ',' on numeric keypad with
|
||||||
* NumLock off on
|
* NumLock off on VT100/VT220/VT320/xterm/
|
||||||
* VT100/VT220/VT320/xterm/rxvt. */
|
* rxvt. */
|
||||||
retval = '+';
|
retval = '+';
|
||||||
break;
|
break;
|
||||||
case 'm': /* Esc O m == '-' on numeric keypad with
|
case 'm': /* Esc O m == '-' on numeric keypad with
|
||||||
* NumLock off on
|
* NumLock off on VT100/VT220/VT320/xterm/
|
||||||
* VT100/VT220/VT320/xterm/rxvt. */
|
* rxvt. */
|
||||||
retval = '-';
|
retval = '-';
|
||||||
break;
|
break;
|
||||||
case 'n': /* Esc O n == Delete (.) on numeric keypad
|
case 'n': /* Esc O n == Delete (.) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/xterm/rxvt. */
|
* xterm/rxvt. */
|
||||||
retval = NANO_DELETE_KEY;
|
retval = NANO_DELETE_KEY;
|
||||||
break;
|
break;
|
||||||
case 'o': /* Esc O o == '/' on numeric keypad with
|
case 'o': /* Esc O o == '/' on numeric keypad with
|
||||||
* NumLock off on
|
* NumLock off on VT100/VT220/VT320/xterm/
|
||||||
* VT100/VT220/VT320/xterm/rxvt. */
|
* rxvt. */
|
||||||
retval = '/';
|
retval = '/';
|
||||||
break;
|
break;
|
||||||
case 'p': /* Esc O p == Insert (0) on numeric keypad
|
case 'p': /* Esc O p == Insert (0) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/rxvt. */
|
* rxvt. */
|
||||||
retval = NANO_INSERTFILE_KEY;
|
retval = NANO_INSERTFILE_KEY;
|
||||||
break;
|
break;
|
||||||
case 'q': /* Esc O q == End (1) on numeric keypad
|
case 'q': /* Esc O q == End (1) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/rxvt. */
|
* rxvt. */
|
||||||
retval = NANO_END_KEY;
|
retval = NANO_END_KEY;
|
||||||
break;
|
break;
|
||||||
case 'r': /* Esc O r == Down (2) on numeric keypad
|
case 'r': /* Esc O r == Down (2) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/rxvt. */
|
* rxvt. */
|
||||||
retval = NANO_NEXTLINE_KEY;
|
retval = NANO_NEXTLINE_KEY;
|
||||||
break;
|
break;
|
||||||
case 's': /* Esc O s == PageDown (3) on numeric
|
case 's': /* Esc O s == PageDown (3) on numeric
|
||||||
* keypad with NumLock off on
|
* keypad with NumLock off on VT100/VT220/
|
||||||
* VT100/VT220/VT320/rxvt. */
|
* VT320/rxvt. */
|
||||||
retval = NANO_NEXTPAGE_KEY;
|
retval = NANO_NEXTPAGE_KEY;
|
||||||
break;
|
break;
|
||||||
case 't': /* Esc O t == Left (4) on numeric keypad
|
case 't': /* Esc O t == Left (4) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/rxvt. */
|
* rxvt. */
|
||||||
retval = NANO_BACK_KEY;
|
retval = NANO_BACK_KEY;
|
||||||
break;
|
break;
|
||||||
case 'u': /* Esc O u == Center (5) on numeric keypad
|
case 'u': /* Esc O u == Center (5) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
*ignore_seq = TRUE;
|
*ignore_seq = TRUE;
|
||||||
break;
|
break;
|
||||||
case 'v': /* Esc O v == Right (6) on numeric keypad
|
case 'v': /* Esc O v == Right (6) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/rxvt. */
|
* rxvt. */
|
||||||
retval = NANO_FORWARD_KEY;
|
retval = NANO_FORWARD_KEY;
|
||||||
break;
|
break;
|
||||||
case 'w': /* Esc O w == Home (7) on numeric keypad
|
case 'w': /* Esc O w == Home (7) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/rxvt. */
|
* rxvt. */
|
||||||
retval = NANO_HOME_KEY;
|
retval = NANO_HOME_KEY;
|
||||||
break;
|
break;
|
||||||
case 'x': /* Esc O x == Up (8) on numeric keypad
|
case 'x': /* Esc O x == Up (8) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/rxvt. */
|
* rxvt. */
|
||||||
retval = NANO_PREVLINE_KEY;
|
retval = NANO_PREVLINE_KEY;
|
||||||
break;
|
break;
|
||||||
case 'y': /* Esc O y == PageUp (9) on numeric keypad
|
case 'y': /* Esc O y == PageUp (9) on numeric keypad
|
||||||
* with NumLock off on
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* VT100/VT220/VT320/rxvt. */
|
* rxvt. */
|
||||||
retval = NANO_PREVPAGE_KEY;
|
retval = NANO_PREVPAGE_KEY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -751,39 +749,39 @@ int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||||
case '1':
|
case '1':
|
||||||
if (es_len >= 3) {
|
if (es_len >= 3) {
|
||||||
switch (escape_seq[2]) {
|
switch (escape_seq[2]) {
|
||||||
case '1': /* Esc [ 1 1 ~ == F1 on
|
case '1': /* Esc [ 1 1 ~ == F1 on rxvt/
|
||||||
* rxvt/Eterm. */
|
* Eterm. */
|
||||||
retval = KEY_F(1);
|
retval = KEY_F(1);
|
||||||
break;
|
break;
|
||||||
case '2': /* Esc [ 1 2 ~ == F2 on
|
case '2': /* Esc [ 1 2 ~ == F2 on rxvt/
|
||||||
* rxvt/Eterm. */
|
* Eterm. */
|
||||||
retval = KEY_F(2);
|
retval = KEY_F(2);
|
||||||
break;
|
break;
|
||||||
case '3': /* Esc [ 1 3 ~ == F3 on
|
case '3': /* Esc [ 1 3 ~ == F3 on rxvt/
|
||||||
* rxvt/Eterm. */
|
* Eterm. */
|
||||||
retval = KEY_F(3);
|
retval = KEY_F(3);
|
||||||
break;
|
break;
|
||||||
case '4': /* Esc [ 1 4 ~ == F4 on
|
case '4': /* Esc [ 1 4 ~ == F4 on rxvt/
|
||||||
* rxvt/Eterm. */
|
* Eterm. */
|
||||||
retval = KEY_F(4);
|
retval = KEY_F(4);
|
||||||
break;
|
break;
|
||||||
case '5': /* Esc [ 1 5 ~ == F5 on
|
case '5': /* Esc [ 1 5 ~ == F5 on xterm/
|
||||||
* xterm/rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
retval = KEY_F(5);
|
retval = KEY_F(5);
|
||||||
break;
|
break;
|
||||||
case '7': /* Esc [ 1 7 ~ == F6 on
|
case '7': /* Esc [ 1 7 ~ == F6 on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/xterm/rxvt/Eterm. */
|
* xterm/rxvt/Eterm. */
|
||||||
retval = KEY_F(6);
|
retval = KEY_F(6);
|
||||||
break;
|
break;
|
||||||
case '8': /* Esc [ 1 8 ~ == F7 on
|
case '8': /* Esc [ 1 8 ~ == F7 on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/xterm/rxvt/Eterm. */
|
* xterm/rxvt/Eterm. */
|
||||||
retval = KEY_F(7);
|
retval = KEY_F(7);
|
||||||
break;
|
break;
|
||||||
case '9': /* Esc [ 1 9 ~ == F8 on
|
case '9': /* Esc [ 1 9 ~ == F8 on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/xterm/rxvt/Eterm. */
|
* xterm/rxvt/Eterm. */
|
||||||
retval = KEY_F(8);
|
retval = KEY_F(8);
|
||||||
break;
|
break;
|
||||||
case ';':
|
case ';':
|
||||||
|
@ -835,59 +833,59 @@ int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||||
if (es_len >= 3) {
|
if (es_len >= 3) {
|
||||||
switch (escape_seq[2]) {
|
switch (escape_seq[2]) {
|
||||||
case '0': /* Esc [ 2 0 ~ == F9 on
|
case '0': /* Esc [ 2 0 ~ == F9 on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/xterm/rxvt/Eterm. */
|
* xterm/rxvt/Eterm. */
|
||||||
retval = KEY_F(9);
|
retval = KEY_F(9);
|
||||||
break;
|
break;
|
||||||
case '1': /* Esc [ 2 1 ~ == F10 on
|
case '1': /* Esc [ 2 1 ~ == F10 on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/xterm/rxvt/Eterm. */
|
* xterm/rxvt/Eterm. */
|
||||||
retval = KEY_F(10);
|
retval = KEY_F(10);
|
||||||
break;
|
break;
|
||||||
case '3': /* Esc [ 2 3 ~ == F11 on
|
case '3': /* Esc [ 2 3 ~ == F11 on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/xterm/rxvt/Eterm. */
|
* xterm/rxvt/Eterm. */
|
||||||
retval = KEY_F(11);
|
retval = KEY_F(11);
|
||||||
break;
|
break;
|
||||||
case '4': /* Esc [ 2 4 ~ == F12 on
|
case '4': /* Esc [ 2 4 ~ == F12 on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/xterm/rxvt/Eterm. */
|
* xterm/rxvt/Eterm. */
|
||||||
retval = KEY_F(12);
|
retval = KEY_F(12);
|
||||||
break;
|
break;
|
||||||
case '5': /* Esc [ 2 5 ~ == F13 on
|
case '5': /* Esc [ 2 5 ~ == F13 on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
retval = KEY_F(13);
|
retval = KEY_F(13);
|
||||||
break;
|
break;
|
||||||
case '6': /* Esc [ 2 6 ~ == F14 on
|
case '6': /* Esc [ 2 6 ~ == F14 on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
retval = KEY_F(14);
|
retval = KEY_F(14);
|
||||||
break;
|
break;
|
||||||
default: /* Esc [ 2 ~ == Insert on
|
default: /* Esc [ 2 ~ == Insert on
|
||||||
* VT220/VT320/Linux
|
* VT220/VT320/Linux console/
|
||||||
* console/xterm. */
|
* xterm. */
|
||||||
retval = NANO_INSERTFILE_KEY;
|
retval = NANO_INSERTFILE_KEY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '3': /* Esc [ 3 ~ == Delete on
|
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
|
||||||
* VT220/VT320/Linux console/xterm. */
|
* Linux console/xterm. */
|
||||||
retval = NANO_DELETE_KEY;
|
retval = NANO_DELETE_KEY;
|
||||||
break;
|
break;
|
||||||
case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux
|
case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux
|
||||||
* console/xterm. */
|
* console/xterm. */
|
||||||
retval = NANO_END_KEY;
|
retval = NANO_END_KEY;
|
||||||
break;
|
break;
|
||||||
case '5': /* Esc [ 5 ~ == PageUp on
|
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
|
||||||
* VT220/VT320/Linux console/xterm; Esc [
|
* Linux console/xterm; Esc [ 5 ^ ==
|
||||||
* 5 ^ == PageUp on Eterm. */
|
* PageUp on Eterm. */
|
||||||
retval = NANO_PREVPAGE_KEY;
|
retval = NANO_PREVPAGE_KEY;
|
||||||
break;
|
break;
|
||||||
case '6': /* Esc [ 6 ~ == PageDown on
|
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
|
||||||
* VT220/VT320/Linux console/xterm; Esc [
|
* Linux console/xterm; Esc [ 6 ^ ==
|
||||||
* 6 ^ == PageDown on Eterm. */
|
* PageDown on Eterm. */
|
||||||
retval = NANO_NEXTPAGE_KEY;
|
retval = NANO_NEXTPAGE_KEY;
|
||||||
break;
|
break;
|
||||||
case '7': /* Esc [ 7 ~ == Home on rxvt. */
|
case '7': /* Esc [ 7 ~ == Home on rxvt. */
|
||||||
|
@ -903,17 +901,17 @@ int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||||
retval = NANO_INSERTFILE_KEY;
|
retval = NANO_INSERTFILE_KEY;
|
||||||
break;
|
break;
|
||||||
case 'A': /* Esc [ A == Up on ANSI/VT220/Linux
|
case 'A': /* Esc [ A == Up on ANSI/VT220/Linux
|
||||||
* console/FreeBSD console/Hurd
|
* console/FreeBSD console/Hurd console/
|
||||||
* console/rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
case 'B': /* Esc [ B == Down on ANSI/VT220/Linux
|
case 'B': /* Esc [ B == Down on ANSI/VT220/Linux
|
||||||
* console/FreeBSD console/Hurd
|
* console/FreeBSD console/Hurd console/
|
||||||
* console/rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
case 'C': /* Esc [ C == Right on ANSI/VT220/Linux
|
case 'C': /* Esc [ C == Right on ANSI/VT220/Linux
|
||||||
* console/FreeBSD console/Hurd
|
* console/FreeBSD console/Hurd console/
|
||||||
* console/rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
case 'D': /* Esc [ D == Left on ANSI/VT220/Linux
|
case 'D': /* Esc [ D == Left on ANSI/VT220/Linux
|
||||||
* console/FreeBSD console/Hurd
|
* console/FreeBSD console/Hurd console/
|
||||||
* console/rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
retval = get_escape_seq_abcd(escape_seq[1]);
|
retval = get_escape_seq_abcd(escape_seq[1]);
|
||||||
break;
|
break;
|
||||||
case 'E': /* Esc [ E == Center (5) on numeric keypad
|
case 'E': /* Esc [ E == Center (5) on numeric keypad
|
||||||
|
@ -965,11 +963,10 @@ int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||||
* xterm. */
|
* xterm. */
|
||||||
retval = KEY_F(4);
|
retval = KEY_F(4);
|
||||||
break;
|
break;
|
||||||
default: /* Esc [ O == F3 on
|
|
||||||
* FreeBSD console. */
|
|
||||||
retval = KEY_F(3);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* Esc [ O == F3 on FreeBSD console. */
|
||||||
|
retval = KEY_F(3);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'P': /* Esc [ P == F4 on FreeBSD console. */
|
case 'P': /* Esc [ P == F4 on FreeBSD console. */
|
||||||
|
@ -1007,8 +1004,8 @@ int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||||
break;
|
break;
|
||||||
case 'a': /* Esc [ a == Shift-Up on rxvt/Eterm. */
|
case 'a': /* Esc [ a == Shift-Up on rxvt/Eterm. */
|
||||||
case 'b': /* Esc [ b == Shift-Down on rxvt/Eterm. */
|
case 'b': /* Esc [ b == Shift-Down on rxvt/Eterm. */
|
||||||
case 'c': /* Esc [ c == Shift-Right on
|
case 'c': /* Esc [ c == Shift-Right on rxvt/
|
||||||
* rxvt/Eterm. */
|
* Eterm. */
|
||||||
case 'd': /* Esc [ d == Shift-Left on rxvt/Eterm. */
|
case 'd': /* Esc [ d == Shift-Left on rxvt/Eterm. */
|
||||||
retval = get_escape_seq_abcd(escape_seq[1]);
|
retval = get_escape_seq_abcd(escape_seq[1]);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue