Subject: Re: home end keys do not work
To: Lubos Vrbka <shnek@tiscali.cz>
From: Johnny Billquist <bqt@update.uu.se>
List: netbsd-users
Date: 07/12/2004 21:21:39
On Mon, 12 Jul 2004, Lubos Vrbka wrote:

> hi guys,
>
> some time ago i asked about my problem with 'home' and 'end' key
> behaviour (but with only one response stating that it works) - so i'm
> trying again... with more details now.
>
> these keys do not work neither on terminal nor in xterm (aterm). this is
> sometimes very annoying (for example when editing long command line)...
> they just produce tilde character on the command line.
>
> i'm using ksh, but i observed similar behaviour with csh, too (but there
> home produces ^[[1~ end produces ^[[4~)

That tells me that your aterm (don't say xterm if your using aterm, by the
way) is interpreting the keys correctly, and passing the appropriate
escape sequences in response to the keys.
In a terminal window, you must remap those keys (which have keysyms in X)
into some sequence of characters, since that is all you have available to
you when playing with simple text interfaces.

The sequences normally chosen for all this stuff is as per the VT100 or
newer terminals. They don't, any of them, have a HOME or END key. A pure
VT100 don't have any of those funny extra keys between the typewriter keys
and the numeric keyboard.
However, the VT200 and newer series have FIND, INSERT, REMOVE, SELECT,
PREVIOUS and NEXT. In your case (which I believe is pretty normal), the
programmers chose to map the HOME key to FIND (which is CSI 1 ~) and
SELECT (which is CSI 4 ~).

The fact that you *see* the tilde, or in csh, CSI 1 ~, means that the
shell don't care to interpret them.

So, your problem is one of two things:

1) You shell simple are not able to handle these keycodes.
2) You've said that you have VT100, or similar terminal, whch don't have
   any key sending the sequence CSI n ~

Start by telling the system that you have an aterm (or xterm, if aterm
isn't known). If that don't help, try saying that you have a VT220 or
similar. *Don't* say you have a VT1xx! And don't say you have some silly
terminal type which have no capabilities at all. The system might actually
believe you.

If that don't help, try a modern version of a shell know to have some
advanced screen and keyboard handling for a long time, such as tcsh, or
bash.

	Johnny

Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt@update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol