Double-ESC

Steve Wahl steve at digibd.com
Sat Jan 19 09:29:17 AEST 1991


In article <1551 at glyph.UUCP> ahh at glyph.UUCP (Andy Heffernan) writes:
>In article <1991Jan07.045230.2540 at quest.UUCP> ssb at quest.UUCP (Scott Sheldon Bertilson) writes:
>>
>>  Just fiddled a little and found that the WIOCSESC can be used
>>to turn it off or on.  Any non-zero argument enables it, and a
>>0 argument disables it:
>>	ioctl(0, WIOCSESC, 0);	/* disable */
>>	ioctl(0, WIOCSESC, 1);	/* enable */
>
>Yes, a fresh lead from my mysterious informant (actually it was
>Bob Manson, manson at cis.ohio-state.edu -- thanks, Bob) redirected me 
>to that ioctl, and it seems to work.  The return from the ioctl() also
>appears to be the old state of the flag.  Very interesting.
>
>Of course, I don't understand the point of the flag, why it gets
>set in the first place, and why my news software continually fills in 
>a stripped-down Followup-To line whenever I cross-post to unix-pc.general 
>and comp.sys.att.

I think I understand the point of this flag.  When parsing an input stream
from a terminal, keys such as F1 and the arrow keys usually send a multiple
character sequence, and these sequeces usually start with an ESC.  If
your parser receives an ESC, it can either be from pressing the ESC
key or from pressing one of the function keys.  The only way to tell
the difference is to wait and see if the characters that follow make
up the sequence that one of the function keys send; if not, it was
just the escape key.  In many cases, such as vi(1), the user wants
the ESC alone to cause some action without pressing any more keys, so
a timeout is usually used also -- if no more characters come in before
the timeout expires, the program assumes that only the escape key was
pressed.

If the escape key always sent two escapes, the timeout wouldn't be
necessary, and the keyboard input parsing routine would be much easier
to write; one could also be more certain about whether the escape key was
pressed or not.  That's probably what this feature is used for (in the
TAM routines, if I'm not mistaken).

--> Steve
-- 

Steve Wahl               steve at digibd.com
DigiBoard Inc.
St. Louis Park, MN       (612) 922-8055



More information about the Comp.sys.att mailing list