NetBSD-Users archive

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

Re: Backspace, Delete and other keys



Greg A. Woods wrote:
At Wed, 31 Mar 2010 22:07:05 +0200, Johnny Billquist <bqt%softjar.se@localhost> 
wrote:
Subject: Re: Backspace, Delete and other keys
Greg A. Woods wrote:
See, for instance, <URL:http://en.wikipedia.org/wiki/Backspace>
Whoa! That page was rather revisionistic.

:-)

And worse they completely forgot to mention the use of backspace with
whiteout, which being an English-speaking Canadian, was the primary
reason I used the backspace key on a typewriter.  :-)

I suspect this meaning of using "backspace" to correct a mistake is very
widely held, at least in primarily English-speaking regions.

Probably.

Someone should send them the layout of a VT100 keyboard.

No need -- I've got a real one in the garage. :-)

Not you. Them!

Sadly some East-coast folks were no help when they decided that
<Control-H> was distinct from <Backspace>.  :-)
Hmm. I don't know at all who you are referring to now. Please enlighten me.

Unless I'm mixing my metaphors the wrong way I refer primarily to GNU
Emacs and the desire to have the "help" function bound to the somewhat
logical <Control-H> key sequence, but I think it was more a MIT thing
overall, which also influenced Digital Equipment Corporation's
engineers.

Ah! That came long before GNU-Emacs, though.
But I think you can blame RMS anyway, since he was the author of most of the original Emacs as well.

But in general, DEC *never* used BS to delete characters, and none of their terminals sent that code when you used the canonical key to delete to the left.

The VT100 indeed had a backspace key, but I don't think any other of their terminals even had that (hmm, maybe the LA120, but I'm not entirely sure).

(Personally I find <Meta-?> to be a far more meaningful key sequence to
use for finding "help" in Emacs, thus I don't have any problem with the
fact the backspace key usually generates an ASCII BS.  :-))

Meta-anything is tricky, in that it either requires that you use the 8th bit as the meta modifier, or else run on something that can pass more information than a serial connection can.

Yes, in the way that there is no <Control-anything> in the ASCII table.
That's just a way to generate non-printable characters on most keyboards. So most keyboards allows you to generate a BS, by pressing ^H, the same way that you can press ^M as an alternative to pressing the return key (assuming your keyboard sends a CR when someone press the return key).

Indeed, but again the big problem being for those people who want to use
the <Control> key as a separate modifier key, and ideally (i.e. without
ASCII in the middle) I'm sure they would have kept all <control-> key
values separate from the ASCII "control" characters (i.e. the keys with
names like "return" and "backspace" would generate the similarly named
ASCII control characters, while the <Control-> modified keys would
generate some entirely different values outside of ASCII, but then they
also wanted a <Meta-> modifier too, and thus they ran out of bits on
systems with 8-bit communications lines and had be satisfied with
overlaying the <Control-> modifier on the ASCII control codes.

Yes, you could put it that way.

But apart from that, much confusion stems from the fact that people don't distinguish between key labels, the codes they send, and how the OS reacts when receiving them.

Perhaps, though I contend most of it is a relatively recent invention.

I disagree. :-)
People press keys on keyboards. Keys have symbols on them. Keys then generate some code, which is sent to the OS, and the OS somehow reacts to this. But people tend to ignore (or be unaware) of this fact. What is important here is to understand that we are speaking of three totally separate entities, which needs to agree, for the right thing to happen.

(I'm going to respond to Magnus Erikssons post next, and expand more on this.)

Also some confusion can be eliminated by being careful to use the
correct terminology in this context, i.e. that used by tty(4).  I'll try
to do that here, but I'm bound to fail.  :-)

It's an area filled with booby traps. :-)

Looking historically, most of these have sent the DEL character, with the exception of the "Backspace" key, which usually sends BS. And most any system accepted DEL as the code to delete one character to the left.


The vast majority of early ASCII terminals I have used over the years
generated an ASCII BS (010) character when the key generally found in
the same place as the "backspace" key on a typewriter was pressed, and
generally the Unix tty(4) "erase" character would ideally be set to 010
to make full utility of this key.

Cool. You and I have very different experiences of terminals then.
I've used ADM3A, various Volker-Craig terminals, just about every DEC terminal, Televideos, Telerays, Facit terminals, ASR33, and god knows what else. None of them have sent BS. A few of them could possibly have been set up to select what character to be sent, so maybe a few of them could be made to send BS if needed (not that I've ever needed).

Unix originally had a totally different mapping. It used @ to delete a line, and # to delete a character (unless I just accidentally swapped them now). Eventually people in general got tired of that idea, and wanted to use those characters in their input. And also, since they were using terminals common of that day, they shifted to using DEL to delete characters.

Well, that original mapping came from the use of an ASR-33 and similar
printing terminals of course, where it was more convenient to use the
lone "rub out" key to kill the current process (send it a SIGINTR), and
since the original tty(4) driver didn't try to update the printout to
show the effect of the erase character (over-striking would be kinda
pointless anyway, if indeed the print carriage could even be backspaced
by one character), a printed "#" was a clear indication to the user of
how to figure out what was still in the input line buffer.  Note from
V7's tty(4) that receipt of an ASCII DEL (0177) character was hard-coded
and could not be changed, unlike sg_erase and sg_kill, which could be
easily changed with stty(1) to be any character.

Yeah. Unix was always an oddball. :-)

I.e. in Unix(tm) land, DEL has always meant send SIGINTR, and has never
meant "erase" the character before the current position, and never could
of course either, since its meaning was hard-coded in the tty(4) driver.

Unfortunately I don't have any history for stty, so I don't know how far back it reaches, but I thought these were all hardcoded in the early days.

Later on, they could all be changed. And I suspect it's a BSDism that you have "stty dec", which will set sane values for them.

On the West Coast the Berkeley folks invented newtty(4) and there made
the default "erase" character be ASCII BS (010), likely to match what
common "smart" CRT-based terminals were generating from the key
positioned near to where the backspace key on a typewriter was placed.

So, no, Unix people did not switch to using DEL to erase characters.
Most anyone who had any experience with early Unix was unlikely to ever
switch to using DEL to delete previous characters -- they were very well
accustomed to using it as the interrupt character!  It was only the
people who started out with some experience with other systems where
<Control-C> was the interrupt character, and who first encountered
Unix-based systems _after_ the invention of newtty(4) or the somewhat
similar tty(4) driver in Unix System III who sometimes chose to
reconfigure their default settings to use ^C as their interrupt
character, and only maybe then might they choose to use DEL as their
erase character because some few terminals like the DEC VT100 _also_ had
a DEL key conveniently located near to where the backspace key on a
typewriter was located.

Well, you are probably right about the early Unix stuff. I didn't use Unix back then. I had totally forgotten about the mapping to INTR. But, as noted, early terminals didn't even have a backspace key, but they did have a key that sent DEL.
So where this backspace comes from, I don't know.

I.e. Don't blame any of this on the IBM PC for goodness sake!  It didn't
help by mixing conventions so to speak (^C interrupts with ^H erase),
but things were confused long before it came along.

Ok. I'll blame the IBM PC, and Unix then. :-)

        Johnny


Home | Main Index | Thread Index | Old Index