Subject: RE: kern/27256: terminal issues? (insert, home, end, page up, page down, and delete)
To: 'NetBSD GNATS submissions and followups' <gnats-bugs@gnats.netbsd.org>
From: Thomas <sirjesseb@hotmail.com>
List: netbsd-bugs
Date: 10/16/2004 14:49:34
Well, after looking at everything in detail, it seems that the installer
decided to set my i386 console to VT100, though I'm not sure why.  Possibly
because of an older Trident (chip) VGA card (still PCI though...).  Might
also be a bug in the installer, though I'm not quite sure.  

Changing the terminal over to wsvt25 doesn't seem to fix the key issues
however.  Page up and Page down work again though, so I'm a bit closer to
what I'm looking for =P.  Also the up-down-left-right arrow keys output
garbage (not handled correctly either?) sometimes [I forget whether it's in
SSH or not...] and Linux does that to me too, so I may as well explore that
in detail and maybe do a manual fix since people don't seem to think that's
a problem... =P.

Thank you for the response, I'll switch the terminal to the correct one and
then see if I can get the mapping to work the way I want (I'll check out the
override thing).  Again thanks =P.

--Thomas

-----Original Message-----
From: Greg A. Woods [mailto:woods@weird.com] 
Sent: Saturday, October 16, 2004 9:44 AM
To: sirjesseb@hotmail.com
Cc: NetBSD GNATS submissions and followups; NetBSD Bugs and PR posting List
Subject: Re: kern/27256: terminal issues? (insert, home, end, page up, page
down, and delete)

[ On Thursday, October 14, 2004 at 01:01:11 (+0000), sirjesseb@hotmail.com
wrote: ]
> Subject: kern/27256: terminal issues?  (insert, home, end, page up, page
down, and delete)
>
> (with TERM=vt100) Seems that the delete key backspaces instead of
> deleting the character in front of the curser...  The rest of the keys
> in that area (insert, home, end, page up and page down) don't seem to
> work as they should either.  In vt220 I believe page up and page down
> work correctly...

The question is though:  what kind of terminal are you actually using?

Or are you using the console virtual terminals?

If the latter then the correct TERM setting (for i386) is "wsvt25m".

Or perhaps you are using an "xterm" virtual terminal?

If so then the correct TERM setting is "xterm".


You can't pick TERM definitions out of a hat or from thin air -- they
_must_ specify a terminal definition that matches the actual terminal
you are using as closely as possible.  This is most critical for telling
things like libcurses what character sequences to send to control things
like cursor positioning, however it's also important for many
applications to know what sequences special keys on the terminal will
send when they are pressed.

As for the backspace/delete issue, well that's probably more related to
whatever your stty(1) "erase" value is set to, though the definition set
by TERM can also specify to the application what the "delete character"
key will send (the "kD" value)

Note that the "Delete" key on most of the DEC VT220 and newer and
compatible terminals sends the sequence:  <ESC> [ 3 ~
(which is called the "remove escape sequence")

The official NetBSD "standard" default for the wscons(4) console
terminal emulator is for the "Backspace" key to generate a DEL character
(instead of the CTRL-H one many of us normally associate with
"backspace").  Most full-screen applications (emacs aside) will honour
the user definition of stty erase.

In X11 with the standard Xfree 4.x server (e.g. on NetBSD/i386) the key
at the top right corner of the main QWERTY block is normally given the
X11 keycode definition of of "Delete", and so in xterm this key sends
the <ESC> [ 3 ~ sequence to the application (unless the "deleteIsDEL"
resource is set to true, in which case it just sends DEL).

Strictly speaking I believe the current wsvt25 terminal type definition
is wrong w.r.t. the value it uses for "kD" (which it inherits from
vt220.  It should probably, IIUC, override it to be \177.

-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack
<woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird
<woods@weird.com>