NetBSD-Users archive

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

Re: That DEL key thing...



bob%proulx.com@localhost (Bob Proulx) writes:

>> xterm then(*) interprets the symbols and generates "^H" for "Backspace"
>> and "^[[3~" for Delete (unless you have configured "DEL is Delete",
>> then it generates a "^?").

>My personal opinion is that Xterm does this the wrong way around.


There are always people who think it is "the wrong way". Yet, it
is the behaviour that you find in most places, and that is mostly
consistent.

RedHat once tried to force xterm to change but gave up. Debian
had (has?) a standard for the keyboard to use DEL, but the Debian
systems I use (and only as a user) default to erase = ^H in
their GUI terminals.


>My memory of events (which is to say possibly faulty) is that IBM and
>therefore others such as HP chose the Backspace key ^H for the stty
>erase setting by default while others (fuzzy memory) chose DEL for the
>stty erase setting.

Our tty driver hardcoded default is to use DEL for the "delete left
of cursor" operation.

/usr/include/sys/ttydefaults.h:#define  CERASE          0177

and you get that result when you talk to a NetBSD serial console:

cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
        min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
        stop = ^S; susp = ^Z; time = 0; werase = ^W;


But for an external terminal, you are supposed to configure it
accordingly. Most easily using the 'tset' command, which will
consult the termcap/terminfo database for the $TERM value.

# echo $TERM
vt100
# tset
Erase set to backspace.    


Even our wscons compatibility value configures it like this:

# echo $TERM
wsvt25
# tset
Erase set to backspace.    


N.B.

The original UNIX tty driver used '#' for erase and the
DEL character would interrupt a program (like ctrl-c does now).

That comes from using a printing terminal where a 'delete left of cursor'
operation doesn't make sense at all and the ready-to-use DEL
key acted as an emergency stop button.

We still support such terminals, e.g. with ^R (reprint)
and the ECHOPRT mode.


>Using ^H for erase creates problems of overloading that useful key in
>Emacs and Emacs has always had workarounds needed for such
>environments.  Emacs on HP-UX always (annoyingly to me) required
>workarounds swapping ^H and ^?.

I personally would say that emacs caused problems by occupying a
common control character. It never worked nicely on terminals
that sent ^H for the "Backarrow" key.

And that's where this all started, computers at that time never
had "a keyboard". People writing programs would use some brand
of terminal and (some of) their programs would just take advantage
of it.

And for the argument, 'vi' has similar issues, just less with
control characters. Instead, parts of the keyboard usage only
make sense on US keyboards with an ANSI layout. :)

You can be glad, that APL never went off (a programming language
that requires a special character set). Yet, some countries use
an additional 'programmers keyboard layout', because their standard
layout isn't sufficient. Or think about 'trigraphs' in the ANSI C
standard.

It never was only 'BS vs. DEL' to think that a keyboard
layout is "the wrong way". :) That's why things like termcap/terminfo
were created. There is no "wrong way", but you can learn
how things work.


>Meanwhile when the Linux kernel came around it chose to use DEL as the
>stty erase character.

You see above that this is not a Linux invention. But what
you find as "hardcoded default" nowadays is not a standard behaviour
anymore but a marker to show that something hasn't been configured
for your environment.

The USB keyboard standard (which defines the "Backarrow" key
to be the "Backspace" symbol which is ^H) and the termcap/terminfo
databases (which document the same for most terminals, including the
common vt100/vt220) are probably the things that will determine
what most people use.

Pity the emacs users.



Home | Main Index | Thread Index | Old Index