Subject: Re: arrow keys
To: None <port-mac68k@NetBSD.ORG>
From: Juergen Nickelsen <jnickelsen@acm.org>
List: port-mac68k
Date: 02/19/1997 10:09:11
At 20:28 -0600 18.2.1997, jfron wrote:

>well, then it generates the propper escape codes in sh and csh.

Except for a possible variation(*) it does not depend on the application
whether the proper escape codes are sent by the console driver.

(*) A VT100 (and its compatibles) may be set to normal mode or application
mode. In normal mode, the cursor keys send ^[[A , ^[[B , ^[[C , ^[[D ; in
application mode the cursor keys send ^[OA , ^[OB , ^[OC , ^[OD . On a
VT220 (and compatibles), the number keypad sends three-character escape
codes in application mode as well. I don't know to what extent the console
driver emulates this behaviour.

>additionally, the delete key doesn't work propperly either (it works, but
>it doesn't delete on screen, just in the command line buffer(?), nor does ^W
>work.

This is because the terminal driver is not set to echo erase and line kill
by default. You can set this with "stty echoe echok".

>an additional related question, i just compiled zsh 3.0.1, and the arrow
>keys don't seem to be generating the propper sequence at all.  they
>simply result in A,B,C, and D.

This is what Paul Goyette said:

>[...] the keys are generating the proper escape codes.  But what ever
>application you're running (or shell) isn't interpreting them.

After reading the ^[[ , the zsh decides "this is an unknown escape sequence
to me" and aborts escape sequence processing. The next character that
arrives, e.g. an A, is taken for normal character input by the user and
thus echoed.

What you need is a way to make the zsh recognize the VT100-like escape
sequences. Perhaps setting the environment variable TERM to vt100 (or
vt220) is enough ("TERM=vt100 ; export TERM" in the zsh, or, as has been
suggested, the appropriate entry in /etc/ttys -- both ways are equivalent
with respect to the zsh). Perhaps the zsh must be told explicitly to
recognize these sequences; in this case, it is probably mentioned in the
manual. Since I don't know the zsh enough (only tried it briefly some years
ago), I can't give you detailed help.

Greetings, Juergen.