[Top][All Lists]

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

Re: Finer keystroke detection

From: Thomas Dickey
Subject: Re: Finer keystroke detection
Date: Tue, 11 May 2004 15:02:27 -0400 (EDT)

On Tue, 11 May 2004, Steve Litt wrote:

> Hi all,
> I've looked thru ncurses.h, and through man terminfo, and various other
> docuemntation, and for the life of me I cannot find how to detect things like
> Ctrl+Enter, Ctrl+F3, etc. These would be VERY handy for an app I'm writing.

> I even wrote a keystroke detection program to print out the value of
> keystrokes as I type, and according to that program, Enter, Shift+Enter and
> Ctrl+Enter are identical. According to my program, the alt and Ctrl keys have
> no modification effect on function keys etc.

That's because most terminals send exactly the same escape sequences
irregardless of the modifiers used.  I know of only a handful of
exceptions to that.  XFree86 xterm and rxvt implement some; I've noticed
that gnome-terminal and konsole copied the sequences I added for xterm. A
few console types (OS/2 for example) also provide different strings. But
still, most do not.  The standard names in terminfo were based on common
behavior.  (I'm puzzled by the shifted cursor keys myself - only two of
the four are defined).

For the terminal types that do provide this sort of capability, it's
almost always sufficient to describe those as the numbered function keys
(terminfo lets you define 60).  Curses can recognize those.  But what
you're describing is (for instance), Linux console which doesn't supply
any different strings.

(If terminals that could do this were more common, it's also possible to
write extended terminfo entries with ncurses that have more meaningful
names than f34, f35, etc.

Thomas E. Dickey

reply via email to

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