Path: utzoo!attcan!uunet!mcvax!unido!ztivax!tumuc!guug!ott
From: ott@guug.UUCP (OTT GmbH)
Newsgroups: comp.unix.wizards
Subject: Re: handling escape characters
Summary: read manual about ioctl & tty
Message-ID: <706@guug.UUCP>
Date: 9 Aug 89 22:36:41 GMT
References: <1989Aug2.164100.7912@elroy.jpl.nasa.gov>
Organization: GUUG, Munich, Germany
Lines: 16

In article <1989Aug2.164100.7912@elroy.jpl.nasa.gov>, paul@jane.jpl.nasa.gov (Paul Asmar) writes:
> 
> 	Has anyone had to write some sort of an editor, and had to deal
> with the escape key carrying on several meanings (i.e. the escape
> sequences, and the key itself).  /etc /etc

I have written a command-line-editor (like dosedit) for unix with the
same syntax like in dos, that is cursor-up and -down move thru the commands
and ESC only clears the current command-line. The way to do this is to set
up the terminal into raw-mode and to make the read-call return after 1 char
being read or after 1/10 seconds of no input. This is the same way vi does
it and differs between ESC only and a cursor-key (like ESC [ A). On slow
terminals however vi receives the ESC of a cursor-key, beeps and interprets
[ and A as commands (try it by editing a file and keep a cursor key pressed).
If you can avoid using the ESC-key in your program, do it.
Joachim Ott, Munich, West Germany