tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: stty erase WTF



Thor Lancelot Simon <tls%panix.com@localhost> writes:

> I am inclined to question whether it is reasonable to trust a
> static configuration database like terminfo about these configurable
> terminal settings.  I do appreciate that on hardwired terminals they
> were often not configurable.  But there are few of those left except
> system consoles.  I would suggest that in fact, less users would lose
> if we were to patch terminfo to override its static value for erase
> with what is available from the tty!

I think you are right and that this is the crux of the problem.  And
further, we have arrived here because xterm uses ^H as erase, because it
is following the PC-style misconfiguration of keyboards to treat the key
that should be delete as backspace, and many people don't like this and
have worked around it.

But regardless of this, xterm has a configuration variable to use as
erase.  I've appended my Xresources notes about this.

> A compromise, any compromise, to disable this exasperating behavior
> in the case of ptys does sound like it would work.

Or additionally/instead disable it entirely for xterm.  The notion that
xterm has a fixed erase key isn't accurate.  We have code to propagate
the erase key across ssh for TERM=xterm, and that should be allowed to
operate.

If one were using a real VT52 and then ssh and thus on a pty, it
probably makes sense to set the remote to the VT52's configuration.  But
given that ssh propagates the erase key, I suspect that changing the
erase key isn't actually necessary now, even if it was necessary with
earlier telnet implementations.  (And no, I have not powered on my VT52
in a very long time.)




/*
 * 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.)
 */

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index