How do you read the arrow keys?
Karl-P. Huestegge
karl at robot.in-berlin.de
Thu Jan 3 02:41:09 AEST 1991
brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>iverson at ivy.uucp (Tim Iverson) writes:
> [ on the problem of interpreting <esc> given escape sequences ]
>> This is a failing of every package I've seen that purports to handle arrow
>> keys in a device independent manner, although, it's such a basic problem
>> that I assume someone somewhere is offering a package that does do it right.
>It's really the terminal's fault, not the programmer's fault. Codes
>coming from the terminal should be uniquely decodable as untimed byte
>streams. In the best situation, no code is a prefix of another.
>A terminal could, for example, produce two <esc>s when you hit the
>escape key. This solves the problem trivially.
>Using timeouts isn't ``doing it right.'' It's an unfortunate kludge to
>deal with the failings of current hardware.
You're right, but a lot of terminals are able to send 8bit iso-8859
Control codes (CSI instead of 'ESC [' and DCS instead of 'ESC P' etc).
DEC's VT220/VT320 can handle this for example. But I don't know if the
termcap/terminfo libs can handle it... I havn't tried yet.
--
Karl-Peter Huestegge karl at robot.in-berlin.de
Berlin Friedenau ..unido!fub!geminix!robot!karl
More information about the Comp.unix.programmer
mailing list