Subject: Re: -key "introduction"
To: Zbigniew Baniewski <>
From: Greg Troxel <>
List: netbsd-users
Date: 03/31/2005 09:05:46
Some things that's perhaps obvious to most but also perhaps worth
pointing out:

Many of us who grew up with real DEC terminals (or the younger set,
with Sun keyboards) think that the PC keyboard layout having a
'backspace' key above return (or above \|) is broken.  This view holds
that terminals are supposed to have a DEL key, sending 0177, in that
location, and that BS should hardly ever be used.  Delete as X11 calls
it, is reasonable to use to delete forward, but isn't an ASCII

A lot of the issues being discussed are the result of tension between
the "PC keyboard is the right layout" view and the traditionalist

I think the default NetBSD behavior on PC keyboards is to have the
keys act as they are labeled, not as how they ought to be labeled.
This arguably follows the Principle of Least Astonishment.  This leads
to xterm setting erase to BS in order to make the Backspace key act
like delete, and ssh propagating this setting to remote systems.  In
an idea world, there would be a way to declare to the system "I
believe in the church of ASCII-0177-on-where-delete-belongs" and get
consistent behavior.  I don't use text console mode often, so haven't
worried about that too much, but with help from others on the netbsd
lists arrived at the following for .Xresources.  Without this, emacs
use in a remote xterm was awkward at best.

The approach below lets gnome/firefox/openoffice etc. work normally at
least on i386, as they ignore xterm mappings and just use X11 key
codes/symbols.  The alternate approach of remapping keys in X11 risks
breaking such programs.

 * The following comments are for those that believe the key that is
 * where the delete (DEL) key belongs (from a VT52 or VT100) should
 * send DEL (0177) and that the terminal erase character should also
 * be DEL (0177).
 * On a PC keyboard, the BackSpace key generates
 * keycode 22 (keysym 0xff08, BackSpace).
 * The "Delete" key is a function key near Insert, not a DEL key, and it
 * generates keycode 107 (keysym 0xffff, Delete).
 * XXX Figure out what happens under X with a keyboard with a real DEL key.

 * Don't mess with the pty's notion of erase (which defaults to DEL in
 * NetBSD).  This should be set on all computers, regardless of the
 * type of keyboard.
*ptyInitialErase: true

 * Make the backarrow key send DEL (without control), rather than BS.
 * This should be set for any display whose keyboard has a key labeled
 * BackSpace where the delete (DEL) key should be.
*backarrowKey: false

 * Alternatively, one could set backarrowKeyIsErase to true, which the
 * man page says would set the backarrowKey state according to whether
 * stty erase character is DEL or BS.

 * It appears that ssh propagates the local stty erase character
 * setting to the remote machine, at least when both ends are NetBSD
 * 1.6.2ish.  Thus, fixing the key that should be delete locally
 * (above) is sufficient to cause the correct behavior on remote
 * systems (i.e., ssh sends 0177 when the key-where-DEL-should-be is
 * pressed, the remote stty erase setting is 0177, in emacs both
 * DEL and M-DEL work correctly, and one can invoke help by sending 010
 * (by typing C-DEL or C-H).  (With the standard behavior of DEL
 * sending BS and stty erase set to BS, one cannot easily invoke help
 * in emacs.)

        Greg Troxel <>