tweaks: rename a variable, for more contrast

master
Benno Schulenberg 2018-01-20 17:28:54 +01:00
parent d85098abda
commit 4ad0490ce4
1 changed files with 24 additions and 24 deletions

View File

@ -761,14 +761,14 @@ int parse_kbinput(WINDOW *win)
* keypad values, into their corresponding key values. These sequences * keypad values, into their corresponding key values. These sequences
* are generated when the keypad doesn't support the needed keys. * are generated when the keypad doesn't support the needed keys.
* Assume that Escape has already been read in. */ * 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]) { switch (seq[0]) {
case 'O': case 'O':
switch (seq[1]) { switch (seq[1]) {
case '1': case '1':
if (seq_len > 4 && seq[2] == ';') { if (length > 4 && seq[2] == ';') {
switch (seq[3]) { switch (seq[3]) {
case '2': case '2':
@ -806,7 +806,7 @@ int convert_sequence(const int *seq, size_t seq_len)
} }
break; break;
case '2': case '2':
if (seq_len >= 3) { if (length >= 3) {
switch (seq[2]) { switch (seq[2]) {
case 'P': /* Esc O 2 P == F13 on xterm. */ case 'P': /* Esc O 2 P == F13 on xterm. */
return KEY_F(13); return KEY_F(13);
@ -820,7 +820,7 @@ int convert_sequence(const int *seq, size_t seq_len)
} }
break; break;
case '5': case '5':
if (seq_len >= 3) { if (length >= 3) {
switch (seq[2]) { switch (seq[2]) {
case 'A': /* Esc O 5 A == Ctrl-Up on Haiku. */ case 'A': /* Esc O 5 A == Ctrl-Up on Haiku. */
return CONTROL_UP; return CONTROL_UP;
@ -933,7 +933,7 @@ int convert_sequence(const int *seq, size_t seq_len)
case '[': case '[':
switch (seq[1]) { switch (seq[1]) {
case '1': case '1':
if (seq_len > 3 && seq[3] == '~') { if (length > 3 && seq[3] == '~') {
switch (seq[2]) { switch (seq[2]) {
case '1': /* Esc [ 1 1 ~ == F1 on rxvt/Eterm. */ case '1': /* Esc [ 1 1 ~ == F1 on rxvt/Eterm. */
return KEY_F(1); 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. */ case '9': /* Esc [ 1 9 ~ == F8 on the same. */
return KEY_F(8); return KEY_F(8);
} }
} else if (seq_len > 4 && seq[2] == ';') { } else if (length > 4 && seq[2] == ';') {
switch (seq[3]) { switch (seq[3]) {
case '2': case '2':
@ -1031,12 +1031,12 @@ int convert_sequence(const int *seq, size_t seq_len)
#endif #endif
} }
} else if (seq_len > 2 && seq[2] == '~') } else if (length > 2 && seq[2] == '~')
/* Esc [ 1 ~ == Home on VT320/Linux console. */ /* Esc [ 1 ~ == Home on VT320/Linux console. */
return KEY_HOME; return KEY_HOME;
break; break;
case '2': case '2':
if (seq_len > 3 && seq[3] == '~') { if (length > 3 && seq[3] == '~') {
switch (seq[2]) { switch (seq[2]) {
case '0': /* Esc [ 2 0 ~ == F9 on VT220/VT320/ case '0': /* Esc [ 2 0 ~ == F9 on VT220/VT320/
* Linux console/xterm/rxvt/Eterm. */ * 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. */ case '9': /* Esc [ 2 9 ~ == F16 on the same. */
return KEY_F(16); return KEY_F(16);
} }
} else if (seq_len > 2 && seq[2] == '~') } else if (length > 2 && seq[2] == '~')
/* Esc [ 2 ~ == Insert on VT220/VT320/ /* Esc [ 2 ~ == Insert on VT220/VT320/
* Linux console/xterm/Terminal. */ * Linux console/xterm/Terminal. */
return KEY_IC; return KEY_IC;
break; break;
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/ case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
* Linux console/xterm/Terminal. */ * Linux console/xterm/Terminal. */
if (seq_len > 2 && seq[2] == '~') if (length > 2 && seq[2] == '~')
return KEY_DC; return KEY_DC;
break; break;
case '4': /* Esc [ 4 ~ == End on VT220/VT320/ case '4': /* Esc [ 4 ~ == End on VT220/VT320/
* Linux console/xterm. */ * Linux console/xterm. */
if (seq_len > 2 && seq[2] == '~') if (length > 2 && seq[2] == '~')
return KEY_END; return KEY_END;
break; break;
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/ case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
* Linux console/xterm/Terminal; * Linux console/xterm/Terminal;
* Esc [ 5 ^ == PageUp on Eterm. */ * Esc [ 5 ^ == PageUp on Eterm. */
if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^')) if (length > 2 && (seq[2] == '~' || seq[2] == '^'))
return KEY_PPAGE; return KEY_PPAGE;
break; break;
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/ case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
* Linux console/xterm/Terminal; * Linux console/xterm/Terminal;
* Esc [ 6 ^ == PageDown on Eterm. */ * Esc [ 6 ^ == PageDown on Eterm. */
if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^')) if (length > 2 && (seq[2] == '~' || seq[2] == '^'))
return KEY_NPAGE; return KEY_NPAGE;
break; break;
case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt; case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt;
* Esc [ 7 $ == Shift-Home on Eterm/rxvt; * Esc [ 7 $ == Shift-Home on Eterm/rxvt;
* Esc [ 7 ^ == Control-Home on Eterm/rxvt; * Esc [ 7 ^ == Control-Home on Eterm/rxvt;
* Esc [ 7 @ == Shift-Control-Home on same. */ * Esc [ 7 @ == Shift-Control-Home on same. */
if (seq_len > 2 && seq[2] == '~') if (length > 2 && seq[2] == '~')
return KEY_HOME; return KEY_HOME;
else if (seq_len > 2 && seq[2] == '$') else if (length > 2 && seq[2] == '$')
return SHIFT_HOME; return SHIFT_HOME;
else if (seq_len > 2 && seq[2] == '^') else if (length > 2 && seq[2] == '^')
return CONTROL_HOME; return CONTROL_HOME;
#ifndef NANO_TINY #ifndef NANO_TINY
else if (seq_len > 2 && seq[2] == '@') else if (length > 2 && seq[2] == '@')
return shiftcontrolhome; return shiftcontrolhome;
#endif #endif
break; break;
@ -1103,14 +1103,14 @@ int convert_sequence(const int *seq, size_t seq_len)
* Esc [ 8 $ == Shift-End on Eterm/rxvt; * Esc [ 8 $ == Shift-End on Eterm/rxvt;
* Esc [ 8 ^ == Control-End on Eterm/rxvt; * Esc [ 8 ^ == Control-End on Eterm/rxvt;
* Esc [ 8 @ == Shift-Control-End on same. */ * Esc [ 8 @ == Shift-Control-End on same. */
if (seq_len > 2 && seq[2] == '~') if (length > 2 && seq[2] == '~')
return KEY_END; return KEY_END;
else if (seq_len > 2 && seq[2] == '$') else if (length > 2 && seq[2] == '$')
return SHIFT_END; return SHIFT_END;
else if (seq_len > 2 && seq[2] == '^') else if (length > 2 && seq[2] == '^')
return CONTROL_END; return CONTROL_END;
#ifndef NANO_TINY #ifndef NANO_TINY
else if (seq_len > 2 && seq[2] == '@') else if (length > 2 && seq[2] == '@')
return shiftcontrolend; return shiftcontrolend;
#endif #endif
break; break;
@ -1143,7 +1143,7 @@ int convert_sequence(const int *seq, size_t seq_len)
case 'N': /* Esc [ N == F2 on FreeBSD console. */ case 'N': /* Esc [ N == F2 on FreeBSD console. */
return KEY_F(2); return KEY_F(2);
case 'O': case 'O':
if (seq_len > 2) { if (length > 2) {
switch (seq[2]) { switch (seq[2]) {
case 'P': /* Esc [ O P == F1 on xterm. */ case 'P': /* Esc [ O P == F1 on xterm. */
return KEY_F(1); return KEY_F(1);
@ -1188,7 +1188,7 @@ int convert_sequence(const int *seq, size_t seq_len)
shift_held = TRUE; shift_held = TRUE;
return arrow_from_abcd(seq[1]); return arrow_from_abcd(seq[1]);
case '[': case '[':
if (seq_len > 2 ) { if (length > 2) {
switch (seq[2]) { switch (seq[2]) {
case 'A': /* Esc [ [ A == F1 on Linux console. */ case 'A': /* Esc [ [ A == F1 on Linux console. */
return KEY_F(1); return KEY_F(1);