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 08:14:15 -0400, Greg Troxel <gdt%ir.bbn.com@localhost> 
wrote:
Subject: Re: Backspace, Delete and other keys
You have been brainwashed by Windows.  Delete is supposed to be ASCII
DEL, which is supposed to delete left.

Ah, that's not MS-Windows fault.  That was a debate started long before
any graphical user interface was ever built.  :-)

Depends on your definition of graphical user interface, I guess. :-)
But I agree that it wasn't MS-Windows. It was more the IBM PC in general.

See, for instance, <URL:http://en.wikipedia.org/wiki/Backspace>

Whoa! That page was rather revisionistic.

There the dilemma is explained as follows:

    In modern systems, the backspace key is often mapped to the delete
    character (0x7f in ASCII or Unicode), although the backspace key's
    function of deleting the character before the cursor remains.

I guess by "modern" the author meant something as new as an ASR-33.  :-)

Someone should send them the layout of a VT100 keyboard.
There you have both a backspace key, and a DELETE key. Guess which sends which code, and what was expected to happen when you pressed them.

And the ASR33 don't have either a Backspace or a Delete key, but a "Rub Out" key. That one will send a DEL when pressed.

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.

And then they got all confused entirely about <Delete>.

Trying to fit ASCII into 7 bits was probably the ultimate cause since it
meant there was no room for separate <Backspace> and <Control-H>.  :-)

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

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.

When a BS character is sent to a terminal, I think (would hope) that most agree that the expected behavior is that the cursor moves to the left, and nothing else happens (thus, the normal way of apparently "delete" a character is to send backspace, space, backspace). When a DEL character is sent to a terminal, most of the time nothing happens. It's not a character with a visible representation, nor any obvious defined characteristic (well, one could argue for the fact that on a paper tape, it will actually "delete" the current character, and that is what it is meant to be used for). When a BS or DEL is sent to the OS from the terminal, it is obvious that the OS can choose to handle them any way it wants to. There is no obvious "right" way.
And then we have the question of which key should send which code.
We have keys with left arrows, labels like "Rub Out", "Delete", "Backspace", "Erase", and graphics like " <X] ".

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.

Now, the IBM PC, being from IBM (which didn't even use ASCII before the PC) did with this, as with many other things on that machine, in a way that was incompatible with most anything else in the market at that time. Kind of like Microsoft is doing now. Pretend to follow a standard, but twist and pervert it some, so that things don't actually work that well with anything else. So, they put a key with a left arrow, but which sent a BS. And then they made their system accept BS as the code to delete one character to the left.

Now comes the question; Should we now all adopt the IBM PC way, or should we keep the old ways? Lots of people (especially younger) now wants the IBM PC way, while some older ones wants the old way.
Go figure.

However, if you want to pretend to be a VT100, layoutwise, the DEL key should be closer to the return key, and the backspace key farther away. Also, if you use any OS contemporary with the VT100, that OS will probably behave so that a received DEL will delete the character to the left of the cursor, while a BACKSPACE will just echo back like any other character.

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.

So, for the original poster. Start by figuring out how you really want to have things working, and then change stuff everywhere needed to get the behavior you expect.

        Johnny


Home | Main Index | Thread Index | Old Index