bug-readline
[Top][All Lists]
Advanced

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

Re: [Bug-readline] [PING] Fix mingw support for Home, End, Insert and De


From: Pierre Muller
Subject: Re: [Bug-readline] [PING] Fix mingw support for Home, End, Insert and Delete keys
Date: Tue, 24 Sep 2013 11:36:35 +0200

  Hi Chet,

  finally it is much easier than
what I expected...

  We can simply use the fact that
the key sequence can be encoded as rl_translate_key  
returns a char array and a length of this array,
thus the '\0' value is not a problem anymore.
  Thus using "\\000P" as a key sequence works like a charm!
See the patch below.


  Can this also be integrated in readline development?

Pierre Muller
GDB pascal language maintainer



2013-09-24  Pierre Muller  <address@hidden>

        * readline.c (bind_arrow_keys_internal): Support
        the numeric keypad arrow keys for mingw hosts.

Index: readline.c
===================================================================
RCS file: /cvs/src/src/readline/readline.c,v
retrieving revision 1.11
diff -u -p -r1.11 readline.c
--- readline.c  11 May 2011 23:38:39 -0000      1.11
+++ readline.c  24 Sep 2013 09:30:48 -0000
@@ -1159,6 +1159,18 @@ bind_arrow_keys_internal (map)
   rl_bind_keyseq_if_unbound ("\340P", rl_get_next_history);
   rl_bind_keyseq_if_unbound ("\340M", rl_forward_char);
   rl_bind_keyseq_if_unbound ("\340K", rl_backward_char);
+  rl_bind_keyseq_if_unbound ("\340G", rl_beg_of_line);
+  rl_bind_keyseq_if_unbound ("\340O", rl_end_of_line);
+  rl_bind_keyseq_if_unbound ("\340S", rl_delete);
+  rl_bind_keyseq_if_unbound ("\340R", rl_overwrite_mode);
+  rl_bind_keyseq_if_unbound ("\\000H", rl_get_previous_history);
+  rl_bind_keyseq_if_unbound ("\\000P", rl_get_next_history);
+  rl_bind_keyseq_if_unbound ("\\000M", rl_forward_char);
+  rl_bind_keyseq_if_unbound ("\\000K", rl_backward_char);
+  rl_bind_keyseq_if_unbound ("\\000G", rl_beg_of_line);
+  rl_bind_keyseq_if_unbound ("\\000O", rl_end_of_line);
+  rl_bind_keyseq_if_unbound ("\\000S", rl_delete);
+  rl_bind_keyseq_if_unbound ("\\000R", rl_overwrite_mode);
 #endif
 
   _rl_keymap = xkeymap;

> -----Message d'origine-----
> De : Chet Ramey [mailto:address@hidden
> Envoyé : lundi 23 septembre 2013 14:23
> À : Pierre Muller
> Cc : address@hidden; address@hidden
> Objet : Re: [Bug-readline] [PING] Fix mingw support for Home, End, Insert
> and Delete keys
> 
> On 9/22/13 4:55 PM, Pierre Muller wrote:
> >
> >     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!
> >
> >   Could you think of a possible way to support such prefixes?
> 
> Since readline uses C strings to store key bindings, it's very difficult,
> as you observed, to have bindings whose value includes NUL.  The only way
> to support such prefixes is to invent some other encoding that maps NUL to
> some other character, but that's difficult to do without knowing all the
> other characters that might possibly appear in an escape sequence.
> 
> Chet
> 
> 
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU    address@hidden
http://cnswww.cns.cwru.edu/~chet/



reply via email to

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