From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25228 invoked by alias); 13 Jun 2005 06:09:42 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 25198 invoked by uid 22791); 13 Jun 2005 06:09:38 -0000 Received: from admin.voldemort.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.9) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 13 Jun 2005 06:09:38 +0000 Received: (qmail 32067 invoked from network); 13 Jun 2005 06:09:36 -0000 Received: from localhost (HELO ?192.168.0.4?) (mitchell@127.0.0.1) by mail.codesourcery.com with SMTP; 13 Jun 2005 06:09:36 -0000 Message-ID: <42AD231D.4000800@codesourcery.com> Date: Mon, 13 Jun 2005 06:09:00 -0000 From: Mark Mitchell User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 To: Mark Kettenis CC: gdb-patches@sources.redhat.com, bug-readline@gnu.org Subject: Re: PATCH: Readline for MinGW References: <200506081742.j58Hg6O0017392@sethra.codesourcery.com> <200506120731.j5C7VMNO030966@elgar.sibelius.xs4all.nl> In-Reply-To: <200506120731.j5C7VMNO030966@elgar.sibelius.xs4all.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-06/txt/msg00149.txt.bz2 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