Subject: Re: An old unix Issue the Delete key how do you fix it
To: None <netbsd-help@NetBSD.org>
From: Greg Troxel <gdt@ir.bbn.com>
List: netbsd-help
Date: 05/03/2007 20:37:40
"James K. Lowden" <jklowden@schemamania.org> writes:

> One of these days, I'd like to do/see a presentation called "Journey of a
> Keystroke" that walked through all the layers of mediation and
> interpretation, and how they're controlled.  I'd like to know why --
> sooner or later, with enough indirection via ssh/rsh -- the backspace key
> starts being echoed as ^H when I mistype a search in less(1).

Basically:

  The IBM PC put a Backspace key where the DEL key ought to be, or maybe
  this is from IBM 3270 etc.

  To atone for their sins, they made BS act like DEL acted from V7 unix
  on (and also on DEC operating systems).

  There are two ways to cope with this (meaning the odd placement of BS,
  together with software like emacs that expects DEL):

    1) Map Backspace to DEL, making the key do what the key that's there
       should.  Don't change anything else, meaning stty erase ^?.  This
       is my approach.  In xterm, Control-Backspace is DEL normally, and
       if you set *ptyInitialErase to true, Control-Backspace is then ^H
       (with plain Backspace DEL).

    2) Leave Backspace as ^H, but then stty erase ^H.  This sets up for
       a whole cascading kludge where many things are changed to cope
       with this:

       a) emacs has code (by experimentation) to remap characters if
       erase is ^H so that pushing the key where DEL ought to be does
       what you expect.  It does this by remapping BS to DEL before the
       keymap sees it.

       In this mode, it's hard to get help.  Even worse, some things (I
       can't remember anymore) don't get remapped properly.

       Hint: Don't try C-M-BS if you are running X.   I have done that
       *twice* while experimenting and composing this message....

       b) When sshing to a remote system, and maybe telnet, propagate
       the value of stty erase.  Logging in from NetBSD to NetBSD with
       OpenSSH does this.  So the programs on the far side also remap ^H
       to DEL.

       If you log in to a remote system in a way that doesn't do this,
       you end up with a mess.  This can happen with a serial port, or a
       non-NetBSD system.


So, I'm in favor of fixing the problem once by fixing the keymap.

> We have all these knobs in case someone drops off an ADM 3A on the front
> stoop (supposing anyone has one, front stoop that is), but a $9.99
> bog-standard PC 101 can still bewilder.  
>
> I hope that's encouragement?  

Yes, but there was no spare time in the OOB data field of your message....