NetBSD-Users archive

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

Re: backspace in wscons console sends ^H to processes



    Date:        Mon, 19 Jul 2021 08:49:31 -0400
    From:        Greg Troxel <gdt%lexort.com@localhost>
    Message-ID:  <rmilf62a2p0.fsf%s1.lexort.com@localhost>

  | As additional background, IMHO all of this confusion arose from the
  | differing setups of DEC computers and the IBM PC.

It is older than that.

  | On a real terminal as
  | one would have used with a PDP-11 or VAX in the 70s/80s/early-90s,

"Real terminals" existed long before PDP-11's or VAXen.  They had keys
that struck paper and made marks.

On those backspace moved backwards a character, and typing something else
overstruck the previous character (sometimes intentionally, often just
making a mess).   Delete did nothing at all.

Some of those paper terminals also had paper tape punches and readers.
This allowed "off line" preparation of input, or messages (these terminals
were used for telex / telegraph type operations, more than computers,
computers just needed something for interactive input, that is something
different than punched cards, and these were available).

When preparing a punched paper tape, to erase a mistaken character, one
relied on "delete does nothing" along with "delete is 0x7f", which when
converted to even parity format, is 0xFF, and since a "1" was recorded on
the tape as a hole, punching a delete changed whatever was there before
into the delete code (all rows punched), which, as above, did nothing.
But to overstrike the previous character, one needed first to move backwards
to be over it - that was what a "backspace" accomplished.

So, on "real terminals" the sequence to erase the previous character was
"backspace delete", and yes, the user had to type both of them - and to
erase two characters, one needed backspace backspace delete delete (etc).

When "glass ttys" started to become popular, their manufacturers
initially provided both keys - but computer systems wouldn't require
users to type both chars, but different systems picked differently.
Some used DEL (most Digital OS's did that), others used BSP (most
other systems, since that was the thing that worked easiest on a glass
tty - overstriking was destructive, so to replace one char with another
one simply did "backspace, replacement".  But DEC had settled on DEL
as the preferred choice before glass ttys (or the "modern" form, Tektronix
had a storage scope kind of thing, which was more like a paper terminal,
just without paper) were invented.

Unix used # for the erase character, as on a paper terminal you could see
that, count how many # chars, and mentally erase that number of previous
other characters (and @ was the line kill character, DEL was "interrupt").

Many unix users (but not all) had come from a DEC background, and in particular
a lot of BSD users, where there was "VMS vs BSD unix" type competition all over
the place.   So when BSD changed the defaults from # and @, they picked the
DEC convention (DEL ^U ^C) - which irritated non-DEC users a bit (like me)
who used non-DEC glass terminals, with BSP in a convenient location, and DEL
somewhere obscure (more obscure, usually smaller key).   Never mind, it was
user configurable (had been since the very early days, at least for erase and
kill - interrupt and quit were not configurable initially - which was one
reason many people in the early days used BSP for erase, DEL remained hard
wired as interrupt).

  | That led, I think,  i386 unix (386BSD, then early NetBSD) to let the key
  | send ^H and configure erase to ^H, breaking emacs

That alone IMO is the biggest feature.   Anything that breaks emacs, even in
trivial ways like this, is GOOD.

  | I don't see that as possible, and I have no idea why you would want
  | that.  Once you have the key that is logically the delete key sending
  | DEL as original ASCII intended,

It certainly intended nothing of the kind, DEL was "deleted" just as NUL
was "never entered" (empty space on the paper tape where nothing had been
punched).   Both were simply ignored and had no effect whatever (and so
could be used for padding characters after sending something which the
terminal would take a long time to execute, like carriage-return or line
feed.

If you ever actually used paper tape (I did) the last thing you'd ever want
was for DEL to start being interpreted as anything other than "nothing here".
On the other hand, as backspace never (usually) ever got onto the tape,
it changed its position instead, that one turns out to be a nice choice for
the erase character (paper tapes don't need it - the erasing is already
done).

That using ^H (BSP) as erase screws emacs users is just a bonus point.

  | What are you trying to
  | accomplish with this?   Or are you asking "is there some way to have
  | multiple characters function as erase in the tty"?

But that's a good question.   The tty driver (which is all you get when
you're in cat - unlike in a program which uses libedit or readline, or
similar where all this is done in those libraries, or in the program itself)
has exactly one erase character - you can set it to anything you like
(hopefully something you can type), but you only get one of them (and one
line kill, one interrupt, one quit, one pause output, one restart it, one
discard output, one signal stop (and one delayed version of that).

kre



Home | Main Index | Thread Index | Old Index