[net.unix] vt100 cursor keys not working in vi - fix

geoff@desint.UUCP (Geoff Kuenning) (03/03/85)

>On the few occasions when I use "vi"
>(heh heh), I've seen it get confused when I use the arrow keys on my
>VT100, so I've adjusted to using h/j/k/l.  I suspect it may be related
>to the fact that "vi" does timeouts on input to distinguish escape sequences
>from normal typing (but since I rarely use "vi" I don't really care why
>it does it).

The problem frequently isn't timeouts, it's a termcap error.  I have seen
many vt100 termcap entries (including, I believe, 4.1BSD) that select "DEC
Cursor Key Mode".  In this mode, the arrow keys send <esc>OA-<esc>OD rather
than the usual <esc>[A-<esc>[D.  Unfortunately, the termcap definitions of
ku, kl, kd, and kr use the <esc>[ form rather than the <esc>O form.  The
fix is simple:  either change the :is: capability to stop selecting the
<esc>O form (probably the preferred choice) or change the k[udlr] entries to
list the <esc>O form (less desirable because some programs don't send the
"is" capability).  The string to remove from the "is" capability is
"<esc>[?1h";  this should be changed to "<esc>?1l" (note that these may be
embedded in a longer <esc>[...h strings).

Speaking of this, does anybody know of a use for this "feature" of DEC
terminals?  To my mind it is one of DEC's most useless options, right up
there with the recently-discussed PDP-11 MARK instruction.
-- 

	Geoff Kuenning
	Unix Consultant
	(213) 545-4413
	...!ihnp4!trwrb!desint!geoff