[comp.sys.sgi] lost esc keys - ancient history

goss@SNOW-WHITE.MERIT-TECH.COM (Mike Goss) (11/05/90)

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 when using a terminal emulator and PC connected
> >to his Iris.  We have had the same problem with both vi and emacs
> >and PC's hooked to the Iris serial ports.
...
>     I've noticed the same kind of thing happening on PIs, 4D50s, and our 240,
> on all IRIX versions up to 3.2.1 (which is the latest that we have).  Even our
> old 1400 (yes, it still runs, but nobody wants to use it much anymore) had
> the same behavior.

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.

------------------------------
Mike Goss
Merit Technology Inc.
(214)733-7018
goss@snow-white.merit-tech.com

	Disclaimer: This offer void except where prohibited by law.

buck@drax.gsfc.nasa.gov (Loren (Buck) Buchanan) (11/06/90)

In article <9011041640.AA25355@snow-white.merit-tech.com> goss@SNOW-WHITE.MERIT-TECH.COM (Mike Goss) writes:
>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.

The answer is simple, ensure that the escape sequence arrives at the UNIX
system in one piece, and also ensure that vi, emacs, etc. is not swapped
during the time the escape sequence is being processed.  Oh, dear me, that
is not a simple solution is it ;-)?

Well, an alternate solution is to remap the keys on your terminal to use
a different charcter than escape as the signal character.  A one bit change
from 0x1b to 0x1f (control-_) and then also changing your ex.rc file to
recognize the new signal key.

A third solution is to ignore arrow keys (and function keys altogether,
which is the solution I have used successfully for years).

OK, now where do I go to get my prize ;-) ;-) ;-).

B Cing U

Buck

Loren Buchanan     | buck@drax.gsfc.nasa.gov   | #include <std_disclaimer.h> 
CSC, 1100 West St. | ...!ames!dftsrv!drax!buck | typedef int by
Laurel, MD 20707   | (301) 497-2531            | void where_prohibited(by law){}
Phone tag, America's fastest growing business sport.

mitch@sgi.com (Thomas Mitchell) (11/21/90)

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."