aboutsummaryrefslogtreecommitdiff
path: root/readline/readline.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2005-07-25 15:09:31 +0000
committerMark Mitchell <mark@codesourcery.com>2005-07-25 15:09:31 +0000
commitfd8be987f8334e9530be6ca571c54695892aa871 (patch)
tree60327bf0cf90e57934fbcaf6ff8cee1b5e882083 /readline/readline.c
parent7ef34f2cde1d446fb7ce7d2151446a7ac38aeabd (diff)
downloadgdb-fd8be987f8334e9530be6ca571c54695892aa871.zip
gdb-fd8be987f8334e9530be6ca571c54695892aa871.tar.gz
gdb-fd8be987f8334e9530be6ca571c54695892aa871.tar.bz2
* input.c (rl_getc): Use getch to read console input on
Windows. * readline.c (bind_arrow_keys_internal): Translate Windows keysequences into POSIX key sequences. * rldefs.h (NO_TTY_DRIVER): Define on MinGW. * rltty.c: Conditionalize on NO_TTY_DRIVER throughout.
Diffstat (limited to 'readline/readline.c')
-rw-r--r--readline/readline.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/readline/readline.c b/readline/readline.c
index aed0235..07fb58f 100644
--- a/readline/readline.c
+++ b/readline/readline.c
@@ -868,6 +868,22 @@ bind_arrow_keys_internal (map)
_rl_bind_if_unbound ("\033[0D", rl_get_next_history);
#endif
+#ifdef __MINGW32__
+ /* Under Windows, when an extend key (like an arrow key) is
+ pressed, getch() will return 340 (octal) followed by a code for
+ the extended key. We use macros to transform those into the
+ normal ANSI terminal sequences for these keys. */
+
+ /* Up arrow. */
+ rl_macro_bind ("\340H", "\033[A", map);
+ /* Left arrow. */
+ rl_macro_bind ("\340K", "\033[D", map);
+ /* Right arrow. */
+ rl_macro_bind ("\340M", "\033[C", map);
+ /* Down arrow. */
+ rl_macro_bind ("\340P", "\033[B", map);
+#endif
+
_rl_bind_if_unbound ("\033[A", rl_get_previous_history);
_rl_bind_if_unbound ("\033[B", rl_get_next_history);
_rl_bind_if_unbound ("\033[C", rl_forward_char);