bug-ncurses
[Top][All Lists]
Advanced

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

Re: Problem with keys


From: galapogos
Subject: Re: Problem with keys
Date: Tue, 6 May 2008 08:17:31 -0700 (PDT)



Thomas Dickey-2 wrote:
> 
> On Mon, 5 May 2008, galapogos wrote:
> 
>> Thomas Dickey-2 wrote:
>>>
>>> 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).
>>>
>> I've used infocmp to check. kbs is mapped to ^H, but somehow it's still
>> being translated to ^? or ASCII 127. When I use stty to  change it to ^H
>> with the command "stty erase ^H", in the Linux console a "^?" shows up
>> whenever I press the backspace key, and the ncurses application still
>> shows
>> backspace as ASCII 127.
> 
> If kbs is ^H, then ncurses looks for control/H.
> But if your terminal sends ^?, then ncurses will not know it is backspace.
> 
> Most of the Linux distributions make changes as needed to make the
> terminal emulators send ^? for "backspace", while almost everyone else 
> uses ^H.  They should also modify the terminfo entries in ncurses, but
> not all of the Linux distributions do _that_.
> 
So basically I have to make sure the key mapping in the terminal
emulator(termcap/terminfo) matches the terminfo entries in ncurses?
-- 
View this message in context: 
http://www.nabble.com/Problem-with-keys-tp17009973p17085478.html
Sent from the Gnu - Ncurses mailing list archive at Nabble.com.





reply via email to

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