Email or username:

Password:

Forgot your password?
Top-level
Mark Dominus

@b0rk 0x7f is usually called "delete" or "DEL", to constrast it with 0x08 which is "backspace", and they are different and sometimes the terminal gets confused.

But your chart calls them both "backspace", which I think might tend to add to the amount of confusion in the universe.

10 comments
Julia Evans

@mjd thanks that's a good point -- I'm very confused about what Ctrl-H does in practice -- to me it feels like 0x08 is just kind of some weird old cruft that has no real purpose but maybe that's not true

(if it does have a purpose I'd be interested to know what it is! I don't have a backspace key on my keyboard right now but my impression is that the backspace key is supposed to map to an ASCII DEL)

⛧ esoterik ⛧

@b0rk if you type "abcdef" at a prompt and then put your cursor between c and d (abc|def) then:

0x08 (backspace) usually produces ab|def

0x7f (delete) usually produces abc|ef

@mjd

Zack Weinberg

@b0rk @mjd I know that in the days of printing terminals and paper tape, the ASCII "backspace" and "delete" control codes had two clearly distinct functions.

Backspace meant literally back up the print head or tape punch one space. It *didn't* erase anything, and it was common to "overprint" two or more characters in the same space (a vestige of this survives today, some programs will emit a letter, ^H, and then _, and expect the letter to be underlined).

Delete, on the other hand, meant cross out the character at the *current* print head position. That's why it's all by itself at the high end of the ASCII range: its encoding is all-bits-1, which is all seven holes punched on a 7-bit paper tape, so if you back up your tape punch and punch DEL it completely destroys whatever used to be there.

I do not know how we got from there to how it is today.

@b0rk @mjd I know that in the days of printing terminals and paper tape, the ASCII "backspace" and "delete" control codes had two clearly distinct functions.

Backspace meant literally back up the print head or tape punch one space. It *didn't* erase anything, and it was common to "overprint" two or more characters in the same space (a vestige of this survives today, some programs will emit a letter, ^H, and then _, and expect the letter to be underlined).

Chris Siebenmann

@b0rk @mjd My memory is that there was a big schism in the physical terminal world about what the 'backspace' key generated. Many terminals had it generate Ctrl-H, but some used DEL; I believe DEC terminals such as the VT-100 were in the DEL camp, and they were very popular. This carried over to Unix workstations, with vendors doing different mappings (eg SGI made their 'backspace' key generate Ctrl-H in a default configuration; DEC used DEL of course).

Chris Siebenmann

@b0rk @mjd Today, X on Linux has a 'BackSpace' keysym and a 'Delete' keysym, generated by their respective keyboard keys, but I believe that all terminal emulators map both of them to DEL by default (xterm and gnome-terminal certainly do). Things like browsers tend to make the big BackSpace key delete characters to the left of the cursor (what you expect) and the 'Delete' key delete to the right, which can be a surprise.

Jef Poskanzer :batman:

@cks @b0rk @mjd With Unix caught in the middle of the schism, yeah. I had a small part in resolving things: at a Usenix 'ask the BSD team' session, I stood up and suggested that they deal with it by having two erase characters in the tty driver. And they said, Ok! Thus was born erase2.

Petru Ratiu

@cks @b0rk @mjd To this day my circle of IRC friends uses the mini-joke of ^H^H^H being poorly translated backspace presses even though we collectively forgot what chain of systems was needed to produce this specific "terminal mojibake".

Simon Tatham

@b0rk @mjd I see a lot of people have posted about history, but as I see it the _effects_ of the history are to create two current schools of thought.

1. the Backspace key (above Return) is 0x08, and the Del key (on the nav keypad) is 0x7F

2. Backspace is 0x7F, and Del is some sequence like ESC[3~ (similar to the rest of that keypad)

Emacs users like #2 because it frees up 0x08 to be ^H for help. But enough people like #1 that lots of software all needs a config option!

Stylus

@mjd @b0rk there's also the name "rubout" for code 127. The "all bits set" code was special on paper tape because you could change any other (incorrectly punched) code to it by re-punching. en.m.wikipedia.org/wiki/Delete

Go Up