[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Escape sequences and ncurses
On Sun, 10 Sep 2000, Jay Link wrote:
>
> > > I'm using nurses, and I'm checking for input with getch(), but I want to
> > > know when someone types something funky (like an arrow key).
> > >
> > > How do I check to see if the value returned by getch() includes an escape
> > > sequence? It's an "int" value, so it oughta be simple, but I must be
> > > missing something.
> >
> > man curs_getch
>
>
> Yeah, but then you have to be in something called "keypad" mode, which I'd
> prefer to avoid.
>
from curs_getch.3x:
If keypad is TRUE, and a function key is pressed, the
token for that function key is returned *instead_of_the_raw_
characters*. Possible function keys are defined in
<curses.h> as macros with values outside the range of
8-bit characters whose names begin with KEY_. Thus, a
variable intended to hold the return value of a function
key must be of short size or larger.
If keypad is !TRUE, it delivers the raw characters, in this case, the
first character would be a 0x1B (ESC). of course, they YOU get the rest
of the macro, and get to figure out what it does and/or filter it out from
the data stream.
keypad mode is simply the best way to handle keyboard macros in
noncanonical mode.
Jordan Bettis.
"Probably the best operating system in the world is the [operating system]
made for the PDP-11 by Bell Laboratories." - Ted Nelson, October 1977
-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.