Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.programmer Subject: Re: How do you read the arrow keys? Message-ID: <4927:Dec2920:17:4790@kramden.acf.nyu.edu> Date: 29 Dec 90 20:17:47 GMT References: <3080@dali> <1990Dec28.195518.26577@ivy.uucp> Organization: IR Lines: 17 In article <1990Dec28.195518.26577@ivy.uucp> 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. ---Dan