bug-ncurses
[Top][All Lists]
Advanced

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

Re: Problem with keys


From: Thomas Dickey
Subject: Re: Problem with keys
Date: Sat, 03 May 2008 08:35:39 -0400
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On Fri, May 02, 2008 at 01:42:01AM -0700, galapogos wrote:
> 
> Hi
> I'm building a simple application using ncurses in Mandriva 2008. I have a
> simple text user interface asking the user to enter an ASCII string, and
> then I'm using wgetch() to parse the string, checking if each character is
> an ASCII character using isascii(). I'm also checking for special characters
> such as enter and backspace.
> 
> I'm using KEY_BACKSPACE to detect for backspace. It's ASCII value seems to
> be 263, but when I test my app using Mandriva (Konsole), backspace seems to
> be ASCII value 127 instead, so the backspace is never detected. Why is there
> a discrepancy between the 2?

ncurses will only return KEY_BACKSPACE if the character(s) happen to
match the string kbs in your terminal's description.  It's likely
that is ^H (8) instead.  For some platforms, kbs is normally ^H,
and for others it is normally ^? (127).
 
> Also, I've tested the app on another self compiled Linux kernel(2.6.22.19)
> with busybox. In this environment, backspace is ASCII value 263, so
> KEY_BACKSPACE works. However, the "Break" key, as well as Alt-Break,
> Shift-Break, Ctrl-Break, seems to convert to 2 ASCII characters -  "[P".
> This doesn't happen in Mandriva. What's wrong here? Why is break an ASCII
> character when it's clearly not?

I'll agree with Mike Gran's guess here - it's probably <ESC>[P.
I don't recall seeing anyone map "Break" to a usable key,
but it's certainly doable.

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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