diff --git a/src/proto.h b/src/proto.h index eaf6f098..682538b1 100644 --- a/src/proto.h +++ b/src/proto.h @@ -610,7 +610,6 @@ void implant(const char *string); #endif int get_kbinput(WINDOW *win, bool showcursor); int parse_kbinput(WINDOW *win); -int arrow_from_ABCD(int letter); int parse_escape_sequence(WINDOW *win, int kbinput); int get_byte_kbinput(int kbinput); int get_control_kbinput(int kbinput); diff --git a/src/winio.c b/src/winio.c index 6cc46311..592994e8 100644 --- a/src/winio.c +++ b/src/winio.c @@ -786,6 +786,16 @@ int parse_kbinput(WINDOW *win) return retval; } +/* Return the arrow-key code that corresponds to the given letter. + * (This mapping is common to a handful of escape sequences.) */ +int arrow_from_ABCD(int letter) +{ + if (letter < 'C') + return (letter == 'A' ? KEY_UP : KEY_DOWN); + else + return (letter == 'D' ? KEY_LEFT : KEY_RIGHT); +} + /* Translate escape sequences, most of which correspond to extended * keypad values, into their corresponding key values. These sequences * are generated when the keypad doesn't support the needed keys. @@ -1256,22 +1266,6 @@ int convert_sequence(const int *seq, size_t length, int *consumed) return ERR; } -/* Return the equivalent arrow-key value for the first four letters - * in the alphabet, common to many escape sequences. */ -int arrow_from_ABCD(int letter) -{ - switch (letter) { - case 'A': - return KEY_UP; - case 'B': - return KEY_DOWN; - case 'C': - return KEY_RIGHT; - default: - return KEY_LEFT; - } -} - /* Interpret the escape sequence in the keystroke buffer, the first * character of which is kbinput. Assume that the keystroke buffer * isn't empty, and that the initial escape has already been read in. */