* input.c (rl_getc): Use getch to read console input on
[deliverable/binutils-gdb.git] / readline / readline.c
index aed0235bf3f1dc745bc533793e497a6c03250c06..07fb58fd210d2f973c0bcbc1cf9f6e11af8d5bf9 100644 (file)
@@ -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);
This page took 0.023399 seconds and 4 git commands to generate.