Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!jwt!john From: john@jwt.UUCP (John Temples) Newsgroups: comp.unix.programmer Subject: Re: How do you read the arrow keys? Message-ID: <1990Dec29.170547.3153@jwt.UUCP> Date: 29 Dec 90 17:05:47 GMT References: <3080@dali> <1990Dec28.195518.26577@ivy.uucp> Organization: Private System -- Orlando, FL Lines: 22 In article <1990Dec28.195518.26577@ivy.uucp> iverson@ivy.uucp (Tim Iverson) writes: >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. From the System V/386 Release 3.2 curses man page, under getch(): "If keypad(win, TRUE) has been called, and a function key is pressed, the token for that function key will be returned instead of the raw characters. [...] If a character is received that could be the beginning of a function key (such as escape), curses will set a timer. If the remainder of the sequence is not received within the designated time, the character will be passed through, otherwise the function key value will be returned." I've used this in curses programs I've written which accept both cursor keys and the escape key as input, and it works fine. I guess it's only available in certain versions of curses? -- John W. Temples -- john@jwt.UUCP (uunet!jwt!john)