Delete character
The delete control character (also called DEL or rubout) is the last character in the ASCII repertoire, with the code 127. It is supposed to do nothing and was designed to erase incorrect characters on paper tape. It is denoted as ^? in caret notation and is U+007F in Unicode.
Terminal emulators may produce DEL when ← Backspace key or Control+← Backspace or Control+? are typed.
History
· | NUL | ||||||||||
• | · | • | • | CR | |||||||
• | · | • | LF | ||||||||
• | • | • | • | · | • | • | • | DEL | |||
• | · | SP | |||||||||
"Delete" along with some other ASCII control characters and space as they appear on punched tape |
This code was originally used to mark deleted characters on punched tape, since any character could be changed to all ones by punching holes everywhere. If a character was punched erroneously, punching out all seven bits caused this position to be ignored or deleted.[1][2] In hexadecimal, this is 7F to rub out 7 bits (FF to rubout 8 bits was used for 8-bit codes). This character could also be used as padding to slow down printing after newlines, though the all-zero NUL was more often used.
The Teletype Model 33 provided a key labelled RUB OUT to punch this character (after the user backed up the tape using another button), and did not provide a key that produced the Backspace character (BS). Therefore, a number of less-expensive computer systems that used Teletypes used this key (and thus the Delete code) to ignore the previous mis-typed character. Video terminals designed to replace the teletype then had to place a key that produced this code where Backspace would be expected, in particular in products from Digital Equipment Corporation. On VT100 compatible terminals, this is the character generated by the key labeled Delete.[3][4] On later terminals, such as the VT510, the key is labeled ⌫ (called backarrow in the manual[5]) and by default sent DEL, but could be set up to send BS.
Other terminals designed for systems that did not have a history of using Teletypes would usually make a key at this position send BS, leading to much confusion. Unix, in particular, had an annoying problem that in it could only be programmed to erase the previous character for one of these (not both), thus requiring the user to reconfigure the terminal driver for each brand of terminal. Depending on the type of terminal the designer used, software would sometimes make the shortcuts Ctrl+H or Ctrl+? do something, even though these sent the same code as BS and DEL, assuming the backspace key was sending the other code.
A key marked Backspace ← that sends BS is by far the most common on modern terminals and emulators. To make sure they don't delete backwards, the key marked "Delete" on many terminals does not send DEL and instead sends an escape sequence such as ^[[3~
.[6]
Current use
Unix-like operating systems can still use it as the erase character, i.e. to delete the previous character in the line mode. The terminal driver still cannot be programmed to take both this and Backspace, one must be chosen, however most modern programs bypass this and use libraries such as readline which accepts both codes. Most Unix terminal emulators can be configured to send either Delete or Backspace when the backspace key is pressed.
DOS/Windows never used this character in any way. The BIOS keyboard driver produced Backspace when the backspace key was typed and Null with scan code 5316 when the delete key was typed.[7] In Windows the delete key maps to VK_DELETE (2E16).[8] EGA/VGA fonts, as fonts used by Win32 console, usually have the "house" symbol ⌂ at 127 (0x7F) code point, see Code page 437 for details. However, its legacy can be seen in parts of the Windows operating system: as an example, Control+← Backspace in Microsoft Notepad used to insert the delete character[9] until it was changed in 2018 to make it delete the previous word.[10]
See also
References
- Robert C. Martin (2011). The Clean Coder: A Code of Conduct for Professional Programmers. Pearson Education. ISBN 9780132542883.
- LaFarr (18 August 2006). ""Paper Tape" First Machinable I/O".
- "VT100 Family of Video Terminals". vt100.net.
- "VT100 User Guide- Chapter 3 – Table 3-4 Function Key Codes". vt100.net.
- "VT510 Video Terminal Programmer Information – Chapter 5 – ANSI Control Functions". vt100.net.
- "VT510 Video Terminal Programmer Information – Chapter 8 – Keyboard Processing". vt100.net. Archived from the original on 2016-03-04. Retrieved 2015-04-12.
- https://sites.google.com/site/pcdosretro/scancodes
- https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
- https://superuser.com/a/332034/1175193
- https://makeuseof.com/tag/new-improved-windows-10-notepad