Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!unido!fauern!opal!fub!geminix.in-berlin.de!robot!karl From: karl@robot.in-berlin.de (Karl-P. Huestegge) Newsgroups: comp.unix.programmer Subject: Re: How do you read the arrow keys? Message-ID: <1991Jan2.154109.922@robot.in-berlin.de> Date: 2 Jan 91 15:41:09 GMT References: <3080@dali> <1990Dec28.195518.26577@ivy.uucp> <4927:Dec2920:17:4790@kramden.acf.nyu.edu> Organization: K.-P. Huestegge, Sytemanalyse und Beratung, Berlin Lines: 27 brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >iverson@ivy.uucp (Tim Iverson) writes: > [ on the problem of interpreting 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 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@robot.in-berlin.de Berlin Friedenau ..unido!fub!geminix!robot!karl