Backspace vs. Del

Ian Piumarta ian.piumarta at inria.fr
Wed May 8 16:50:41 UTC 2002


On Wed, 8 May 2002, Hans-Martin Mosner wrote:

> Way back when ASCII was the stuff that teletypes used, DEL was 127, and
> BS was 8. AFAIK, they didn't change that recently...

For doubters, try : `man ascii'. ;)

> Since PC-style keyboards have a 'DEL' key, let's just make our life
> simple and assume that it generates the DEL ASCII code. If it does not,
> fix it at the OS/window system level. And since there's a perfectly
> good key for DEL now, the key above return must generate BS, logically.

On all keyboards I've used that had both, the mapping was exactly that.  
I first came across it on the early Sun4 keyboards which had _two_ "big
fat" keys above return: BackSpace (generating 8) and Delete (generating
127).  In OpenWindows, as shipped and with no mapping changes, the
behaviour was consistent across all applications: BackSpace kills to the
left, Delete to the right.

This is inconsistent with the historical interpretation as explained by
Pete Crowther, and that's the problem.  Different programs/systems
implement one or other of the interpretations.  This leads immediately to
trouble with programs like Emacs (which, as shipped, expect the historical
interpretation) when running on systems that implement the newer, "more
pragmatic", "modern" (now that we don't have teletypes, VT52s, DecWriters
and punched tape any more) interpretation.

Hands up all those people who, when they hit `delete' in a "vanilla"
Emacs, get dumped into the help system [which is triggered on Ctrl-H]. ;-)
Or (worse still) have to consistently use `stty erase ^H' (or `stty erase
^?') just to make login shells and interactive, terminal-based clients
kill to the left with the "big fat" key.

A long time ago I made a Very Big Mistake by mapping 8 to 127 in the Unix
VM.  The reason was this: on all the systems I used at the time, it was
effectively *impossible* to configure all programs to accept 8 as the
"kill to the left" code.  My solution was to change the keyboard mapping
for the "big fat" key to produce 127 instead.  Instant relief.  This kept
Emacs, various shells, lots of interactive clients (like ftp) and telnet
happy.  Along comes Squeak.  The remainder of that story you can
extrapolate easily for yourselves.

> And of course, none of this is Squeak's business.

I agree.  The most problematic application (Emacs) is now configurable
(under X11) to do (the modern interpretation of) the right thing when
Backspace (ascii 8) is typed (delete-char -1) versus Ctrl-H (also ascii 8,
but which generates the C-H prefix for help commands) because now it
bothers to notice that they have different keysyms.

I'm siding with Hans, Lex (regardless of what he's been smoking before
making that last post) and a few others: Squeak should be left (by
default) to implement the "modern" interpretation.  (Apart from anything,
it's more versatile: anyone who still has a Sun4 keyboard has two "big
fat" keys that, in Squeak, delete in different directions.)  Everything
else can be configured at the OS/window level to coexist peacfully and
work consistently (through some more-or-less complex combination of
xmodmap, stty, Emacs customisations, Xterm resources, etc.).

But I admit that it isn't a trivial job to get it just right, especially
the first time for people who have been living for years with either a
keyboard that generates "big fat" 127s, or who have implemented the "quick
and easy" solution in X by mapping their "big fat" keysym to Delete (which
is effectively the same thing).  It's for these people that I invented
"-mapdelbs".

(The best solution of all would be for Tim to volunteer to write
"KeyboardMaker" -- a spiffy drag-and-drop way to assocate any given
keystate in Squeak with any given editor operation.  This would bring
Squeak up to the configurability of programs like xterm and Emacs.  If it 
stored the settings in ".squeakkeys" or somesuch, read on startup, 
things could be persistent across different images.)

Finally, for anyone suffering from this: you are not alone.  (On several
systems that I use I've been too lazy to spend half a day configuring
everything.  I've learned to use "C-B C-D" consistently in Emacs to
delete backwards a character to avoid unpleasat surprises [especially when
connected remotely via telnet/ssh], but at least everywhere I use Squeak
it now works right -- by leaving the mappings in the VM alone.)

EOT

Ian

PS: FWIW, EOT is *defined* as ^D in ISO 646 (= ASCII);  AFAIK, ^Z was
    a CP/M [read: DOS] thing)




More information about the Squeak-dev mailing list