[Top][All Lists]

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

Re: getch

From: Thomas Dickey
Subject: Re: getch
Date: Mon, 29 Nov 2010 17:10:10 -0500 (EST)

On Mon, 29 Nov 2010, Jacques Le Normand wrote:

Dear curses list,
I'm using linux with curses version 5.7+20100626-0ubuntu1. I have a
few questions about input with getch():

1. control enter:
Is there any way to distinguish "control enter" from "enter" ? They
both return the same thing.

It depends on the type of terminal (and how the terminal is configured).
I seem to recall xterm does this in one of its modes.
Generally - no.

2. alt-n and alt-,
When I hold the alt key and I press the n key twice I get 4 inputs (in decimal):

195 174 195 175

That looks like UTF-8 coding (xterm would do this, for instance, using
the eightBitInput feature).

If eightBitInput is false, then xterm would pass an escape character followed by the given character. (It won't modify a function key in
this way - discussed and removed long ago - though rxvt does that).

If I hold the alt key and press ',' twice I get these 4 inputs:

194 172 194 172

Do these numbers mean anything?

Not exactly.  If ncurses (usually ncursesw) is initialized for the locale
so that it knows the input is UTF-8, it would also be able to echo the
character as the given Unicode glyph.  Otherwise, they're just individual
bytes / characters.

3. portability

I've been told that the codes change from system to system. If this is
so, how can I make my application more portable?

It depends on what you're trying to enter with the characters.
Note that above, the terminal configuration determines what happens
to the keystrokes, before ncurses sees them.

I hope I'm posting to the right list. If not, please direct me to a
more appropriate list.

Thank you very much for your time
--Jacques Le Normand

Bug-ncurses mailing list

Thomas E. Dickey

reply via email to

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