Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Mitchell <mark@codesourcery.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sources.redhat.com,  bug-readline@gnu.org
Subject: Re: PATCH: Readline for MinGW
Date: Mon, 13 Jun 2005 06:09:00 -0000	[thread overview]
Message-ID: <42AD231D.4000800@codesourcery.com> (raw)
In-Reply-To: <200506120731.j5C7VMNO030966@elgar.sibelius.xs4all.nl>

Mark Kettenis wrote:

> Huh?  AFAIK, POSIX doesn't say anything about arrow keys or the
> sequences produced by it.  That's all determined by the terminal type.

Yes.  Good point.

> Hmm, it looks like that readline simply hardcodes the ANSI sequences
> for these keys instead of consulting termcap.  Not your fault though.
> But if it did consult termcap, you could provide a stub tgetent() that
> did the mapping.

Indeed.

> Incidentally, I find the way you find you write the macros a bit
> confusing:
> 
>    + #ifdef __MINGW32__
>    +    /* Under Windows, when an extend key (like an arrow key) is
>    +       pressed, getch() will return 0xE0 followed by a code for the
>    +       extended key.  We use macros to transform those into the normal
>    +       UNIX 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
> 
> It has "\34" and "\033" on the same line so I get confused whether
> "\34" is octal or not...
> 
> Also, I don't see any trace of the 0xE0 you mention in the comment.

You're right; that's a suboptimal comment.  Both "\340" and "\033" are 
octal constants; "\033" is 0x27, or escape, and "\340" is 0xe0, which is 
the Windows way of providing an escape sequence.  I have updated my copy 
of the comment to:

   .... return 340 (octal) followed by a ...

Thanks,

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


  parent reply	other threads:[~2005-06-13  6:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-08 17:43 Mark Mitchell
2005-06-12  7:33 ` Mark Kettenis
2005-06-12  8:43   ` Eli Zaretskii
2005-06-12  9:27     ` Mark Kettenis
2005-06-13  6:09   ` Mark Mitchell [this message]
2005-06-15 18:14   ` James Lemke
2005-06-22  1:22   ` Chet Ramey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42AD231D.4000800@codesourcery.com \
    --to=mark@codesourcery.com \
    --cc=bug-readline@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox