Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!zephyr.ens.tek.com!uw-beaver!cornell!calvin.ee.cornell.edu!richard From: richard@calvin.ee.cornell.edu (Richard Brittain - VOS hacker) Newsgroups: comp.unix.programmer Subject: Re: How do you read the arrow keys? Message-ID: <1990Dec29.124554.16702@calvin.ee.cornell.edu> Date: 29 Dec 90 12:45:54 GMT References: <3080@dali> <1990Dec28.195518.26577@ivy.uucp> Organization: Cornell Space Plasma Physics Lines: 28 In article <1990Dec28.195518.26577@ivy.uucp> iverson@ivy.uucp (Tim Iverson) writes: >In article <3080@dali> icsu7039@nero.cs.montana.edu (Spannring) writes: >> I am currently porting some menu routines from MS-DOG to Unix. >>What is the proper (terminal independent) way of reading the arrow >>and/or function keys? > >There're going to be alot of responses about getting curses to decode your >keys for you. And, yes, it will do it, but it has a major problem: no >timeouts; e.g. left arrow on a vt100 (or pc ansi console) is [D, so if >your user hits , curses waits for the next char to come along before >it knows to return the as a key. Also, be prepared to make the timeout delay configurable if you want this to work over a network of any kind. I have read function keys in several programs using a 9600 bps direct connect terminal, with no problems, and using a very short timeout to detect partial escape sequences. When I first tried them from a networked workstation via xterm, I couldn't recognise any sequences because of network delays. Increasing the timeout (up to 500ms per byte sometimes) was needed to fix it. It would certainly be nice if there was a standard library that did this reliably in all cases. -- Richard Brittain, School of Elect. Eng., Eng. and Theory Center Cornell university, Ithaca, NY 14853 INTERNET: richard@calvin.ee.cornell.edu UUCP: {uunet,uw-beaver,rochester,cmcl2}!cornell!calvin!richard