handling escape characters

OTT GmbH ott at guug.UUCP
Thu Aug 10 08:36:41 AEST 1989


In article <1989Aug2.164100.7912 at elroy.jpl.nasa.gov>, paul at 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



More information about the Comp.unix.wizards mailing list