[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] Fix mingw support for Home, End, Insert and Delete keys

From: Pierre Muller
Subject: [Bug-readline] Fix mingw support for Home, End, Insert and Delete keys
Date: Fri, 14 Dec 2012 09:36:46 +0100

  The following patch fixes some non-working keys
for mingw32, when used without ncurses.

  It doesn't fix the problem of the numeric keypad uses
with NumKey Off...
Because those generate a prefix with code 0x0,
but as readline uses zero terminated string for key sequences...
I don't know how I could handle those correctly!


Pierre Muller
GDB pascal language support maintainer

2012-12-10  Pierre Muller  <address@hidden>

        * readline.c (bind_arrow_keys_internal): Add missing handling of
        VK_HOME, VK_END, VK_DELETE and VK_INSERT for mingw hosts.

$ git diff -u -p readline.c
diff --git a/readline.c b/readline.c
index f2e4d93..abb09d1 100644
--- a/readline.c
+++ b/readline.c
@@ -1155,10 +1155,24 @@ bind_arrow_keys_internal (map)
   rl_bind_keyseq_if_unbound ("\033OF", rl_end_of_line);

 #if defined (__MINGW32__)
+  /* Handle Windows OS special keys sent as 0xe0 followed
+     by keycode.  */
+  /* Handles VK_UP keycode.  */
   rl_bind_keyseq_if_unbound ("\340H", rl_get_previous_history);
+  /* Handles VK_DOWN keycode.  */
   rl_bind_keyseq_if_unbound ("\340P", rl_get_next_history);
+  /* Handles VK_RIGHT keycode.  */
   rl_bind_keyseq_if_unbound ("\340M", rl_forward_char);
+  /* Handles VK_LEFT keycode.  */
   rl_bind_keyseq_if_unbound ("\340K", rl_backward_char);
+  /* Handles VK_HOME keycode.  */
+  rl_bind_keyseq_if_unbound ("\340G", rl_beg_of_line);
+  /* Handles VK_END keycode.  */
+  rl_bind_keyseq_if_unbound ("\340O", rl_end_of_line);
+  /* Handles VK_DELETE keycode.  */
+  rl_bind_keyseq_if_unbound ("\340S", rl_delete);
+  /* Handles VK_INSERT keycode.  */
+  rl_bind_keyseq_if_unbound ("\340R", rl_overwrite_mode);

   _rl_keymap = xkeymap;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]