diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-07-25 15:09:31 +0000 |
---|---|---|
committer | Mark Mitchell <mark@codesourcery.com> | 2005-07-25 15:09:31 +0000 |
commit | 5b453ea80382fcd44ec0791f398877b0f7b89e5b (patch) | |
tree | fa5f4acaafaa035b5b088b2bf7163d474f0a2ebe /readline/readline.c | |
parent | ff429e3f95b06cf52ce59b39575c430a91d18b80 (diff) | |
download | gdb-5b453ea80382fcd44ec0791f398877b0f7b89e5b.tar.gz |
* 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.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/readline/readline.c b/readline/readline.c index aed0235bf3f..07fb58fd210 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); |