mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-26 06:39:43 +03:00
tweaks: rename a variable, for more contrast
This commit is contained in:
parent
d85098abda
commit
4ad0490ce4
48
src/winio.c
48
src/winio.c
@ -761,14 +761,14 @@ int parse_kbinput(WINDOW *win)
|
||||
* keypad values, into their corresponding key values. These sequences
|
||||
* are generated when the keypad doesn't support the needed keys.
|
||||
* Assume that Escape has already been read in. */
|
||||
int convert_sequence(const int *seq, size_t seq_len)
|
||||
int convert_sequence(const int *seq, size_t length)
|
||||
{
|
||||
if (seq_len > 1) {
|
||||
if (length > 1) {
|
||||
switch (seq[0]) {
|
||||
case 'O':
|
||||
switch (seq[1]) {
|
||||
case '1':
|
||||
if (seq_len > 4 && seq[2] == ';') {
|
||||
if (length > 4 && seq[2] == ';') {
|
||||
|
||||
switch (seq[3]) {
|
||||
case '2':
|
||||
@ -806,7 +806,7 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
if (seq_len >= 3) {
|
||||
if (length >= 3) {
|
||||
switch (seq[2]) {
|
||||
case 'P': /* Esc O 2 P == F13 on xterm. */
|
||||
return KEY_F(13);
|
||||
@ -820,7 +820,7 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
if (seq_len >= 3) {
|
||||
if (length >= 3) {
|
||||
switch (seq[2]) {
|
||||
case 'A': /* Esc O 5 A == Ctrl-Up on Haiku. */
|
||||
return CONTROL_UP;
|
||||
@ -933,7 +933,7 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
case '[':
|
||||
switch (seq[1]) {
|
||||
case '1':
|
||||
if (seq_len > 3 && seq[3] == '~') {
|
||||
if (length > 3 && seq[3] == '~') {
|
||||
switch (seq[2]) {
|
||||
case '1': /* Esc [ 1 1 ~ == F1 on rxvt/Eterm. */
|
||||
return KEY_F(1);
|
||||
@ -953,7 +953,7 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
case '9': /* Esc [ 1 9 ~ == F8 on the same. */
|
||||
return KEY_F(8);
|
||||
}
|
||||
} else if (seq_len > 4 && seq[2] == ';') {
|
||||
} else if (length > 4 && seq[2] == ';') {
|
||||
|
||||
switch (seq[3]) {
|
||||
case '2':
|
||||
@ -1031,12 +1031,12 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
#endif
|
||||
}
|
||||
|
||||
} else if (seq_len > 2 && seq[2] == '~')
|
||||
} else if (length > 2 && seq[2] == '~')
|
||||
/* Esc [ 1 ~ == Home on VT320/Linux console. */
|
||||
return KEY_HOME;
|
||||
break;
|
||||
case '2':
|
||||
if (seq_len > 3 && seq[3] == '~') {
|
||||
if (length > 3 && seq[3] == '~') {
|
||||
switch (seq[2]) {
|
||||
case '0': /* Esc [ 2 0 ~ == F9 on VT220/VT320/
|
||||
* Linux console/xterm/rxvt/Eterm. */
|
||||
@ -1057,45 +1057,45 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
case '9': /* Esc [ 2 9 ~ == F16 on the same. */
|
||||
return KEY_F(16);
|
||||
}
|
||||
} else if (seq_len > 2 && seq[2] == '~')
|
||||
} else if (length > 2 && seq[2] == '~')
|
||||
/* Esc [ 2 ~ == Insert on VT220/VT320/
|
||||
* Linux console/xterm/Terminal. */
|
||||
return KEY_IC;
|
||||
break;
|
||||
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
|
||||
* Linux console/xterm/Terminal. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
if (length > 2 && seq[2] == '~')
|
||||
return KEY_DC;
|
||||
break;
|
||||
case '4': /* Esc [ 4 ~ == End on VT220/VT320/
|
||||
* Linux console/xterm. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
if (length > 2 && seq[2] == '~')
|
||||
return KEY_END;
|
||||
break;
|
||||
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
|
||||
* Linux console/xterm/Terminal;
|
||||
* Esc [ 5 ^ == PageUp on Eterm. */
|
||||
if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
if (length > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
return KEY_PPAGE;
|
||||
break;
|
||||
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
|
||||
* Linux console/xterm/Terminal;
|
||||
* Esc [ 6 ^ == PageDown on Eterm. */
|
||||
if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
if (length > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
return KEY_NPAGE;
|
||||
break;
|
||||
case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt;
|
||||
* Esc [ 7 $ == Shift-Home on Eterm/rxvt;
|
||||
* Esc [ 7 ^ == Control-Home on Eterm/rxvt;
|
||||
* Esc [ 7 @ == Shift-Control-Home on same. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
if (length > 2 && seq[2] == '~')
|
||||
return KEY_HOME;
|
||||
else if (seq_len > 2 && seq[2] == '$')
|
||||
else if (length > 2 && seq[2] == '$')
|
||||
return SHIFT_HOME;
|
||||
else if (seq_len > 2 && seq[2] == '^')
|
||||
else if (length > 2 && seq[2] == '^')
|
||||
return CONTROL_HOME;
|
||||
#ifndef NANO_TINY
|
||||
else if (seq_len > 2 && seq[2] == '@')
|
||||
else if (length > 2 && seq[2] == '@')
|
||||
return shiftcontrolhome;
|
||||
#endif
|
||||
break;
|
||||
@ -1103,14 +1103,14 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
* Esc [ 8 $ == Shift-End on Eterm/rxvt;
|
||||
* Esc [ 8 ^ == Control-End on Eterm/rxvt;
|
||||
* Esc [ 8 @ == Shift-Control-End on same. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
if (length > 2 && seq[2] == '~')
|
||||
return KEY_END;
|
||||
else if (seq_len > 2 && seq[2] == '$')
|
||||
else if (length > 2 && seq[2] == '$')
|
||||
return SHIFT_END;
|
||||
else if (seq_len > 2 && seq[2] == '^')
|
||||
else if (length > 2 && seq[2] == '^')
|
||||
return CONTROL_END;
|
||||
#ifndef NANO_TINY
|
||||
else if (seq_len > 2 && seq[2] == '@')
|
||||
else if (length > 2 && seq[2] == '@')
|
||||
return shiftcontrolend;
|
||||
#endif
|
||||
break;
|
||||
@ -1143,7 +1143,7 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
case 'N': /* Esc [ N == F2 on FreeBSD console. */
|
||||
return KEY_F(2);
|
||||
case 'O':
|
||||
if (seq_len > 2) {
|
||||
if (length > 2) {
|
||||
switch (seq[2]) {
|
||||
case 'P': /* Esc [ O P == F1 on xterm. */
|
||||
return KEY_F(1);
|
||||
@ -1188,7 +1188,7 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
shift_held = TRUE;
|
||||
return arrow_from_abcd(seq[1]);
|
||||
case '[':
|
||||
if (seq_len > 2 ) {
|
||||
if (length > 2) {
|
||||
switch (seq[2]) {
|
||||
case 'A': /* Esc [ [ A == F1 on Linux console. */
|
||||
return KEY_F(1);
|
||||
|
Loading…
Reference in New Issue
Block a user