Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ames!sgi!shinobu!odin!mitch From: mitch@sgi.com (Thomas Mitchell) Newsgroups: comp.sys.sgi Subject: Re: lost esc keys - ancient history Message-ID: <1990Nov21.031802.13476@odin.corp.sgi.com> Date: 21 Nov 90 03:18:02 GMT References: <9011041640.AA25355@snow-white.merit-tech.com> Sender: news@odin.corp.sgi.com (Net News) Organization: Silicon Graphics Computer Systems, Mountain View CA. 94039 Lines: 55 In article <9011041640.AA25355@snow-white.merit-tech.com> goss@SNOW-WHITE.MERIT-TECH.COM (Mike Goss) writes: >mike@snowhite.cis.uoguelph.ca (no relation) :-) writes: >> rbriber@poly1.nist.gov writes: >> >> >Tim Buxton writes about problems with losing the ESC character >> >from the arrow key codes >You have stumbled across one of the most ancient and mysterious Unix problems >ever to vex the minds of historians! I don't think I've ever worked on >a Unix system that did NOT have this problem, going back to a Perkin-Elmer >3220 running Unix Version 7 (not a misprint; Version 7 came before System V, >for reasons known only to AT&T). > >Anyone who can solve this problem once and for all will certainly earn >the thanks of Unix users everywhere, and perhaps a shot at a Nobel prize >or Turing award, or at least an Edgar. These can be nasty to nail down. Try nailing down jello. If we look at the key map for a bunch of terminals (ANSII are worst (and best)) you will see that hand typed sequences can mimic machine generated sequences. To exit vi's insert mode one needs to type "ESC:wq" or some such. At the same time the arrow/function keys are sending ESCsomething-clever. It turns out that the editor must pay attention to the timing of the keys. If it sees an "ESC...pause....something" the curses/editor/application might correctly deduce that the characters are human typed. On a network link, key strokes can be 'assembled' or not into a packet and the timing IS NOT PRESERVED. This makes it impossible to know the merrit of a given ESC char. Other strange things can happen with a terminal. On my Wyse-50 the down arrow emits a 'new-line(^J)' and the enter key a CR(^M) (or was it ^M/^J). Anyhow it took me days to understand why I could go up, not down, left and right with my arrow keys. Now that I understand and I feel silly for then using the up-arrow then Ctl-V in emacs to wander about a file. Emacs must do the same timing trick. Emacs must decide if the ESC is a special key or a pseudo Meta key. Someday - I will dig into AT&T's streams stuff and see how that can interact with this whole thing. Who knows might fix it (bridge for sale too). -- -- Thomas P. Mitchell -- mitch@sgi.com or mitch%relay.csd@sgi.com "All things in moderation; including moderation."