From: kcwellsch@watdragon.waterloo.edu (Ken Wellsch)
Subject: Re: Cursor key input in curses ?
Date: 21 Apr 91 01:52:51 GMT [thread overview]
Message-ID: <1991Apr21.015251.6148@watdragon.waterloo.edu> (raw)
In-Reply-To: 1991Apr20.160134.1514@urz.unibas.ch
> Problem:
> How do you input cursor keys in curses ?
>
> Please:
> I would be grateful if someone in netland could explain me what goes wrong
> on the vt100 emulation side or even get me a piece of code which reads
> in a cursor key correctly.
I'll put my two-bits in on this one. Unlike VMS which I believe has a
strong dislike for any terminal that is not DEC (e.g. VT100 etc.), a
package like curses has the horrid task of trying to understand numerous
terminal types (thousands of old and new terminals - actually "termcap"
describes them, while curses tries to provide a windowing environment
for a regular tty).
Now if you receive the three characters that a VT100 arrow key sends, or
if your application (say "emacs") understands that set of key strokes to
mean something else (unlikely but possible), how do you decide which it
is? The three characters or "an arrow key was hit?"
The few screen oriented programs that I have studied that attempt to handle
this use the "select" system call as I recall to do very short waits on
input (say 50-100 mSec) and if another character is received that continues
an arrow key-stroke then we continue to guess it is an arrow key and
not separate key strokes. If there is sufficent lag, I think one tended
to assume it was not an arrow key.
I took a very quick look at 4.3BSD's curses source and didn't see anything
attempting this sort of (admittedly painful) approach.
next prev parent reply other threads:[~1991-04-21 1:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1991-04-20 15:01 Cursor key input in curses ? doelz
1991-04-21 1:52 ` Ken Wellsch [this message]
1991-04-23 0:42 ` M Darrin Chaney
1991-04-24 14:01 ` Leonard Peirce
1991-04-24 17:46 ` Van Cleef Henry H
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox