Backspace and delete key behaviour on OpenVMS
Published: 09-04-2018 | Author: Remy van Elst | Text only version of this article
❗ This post is over two years old. It may no longer be up to date. Opinions may have changed.
(You can read all my OpenVMS articles by clicking the picture above)
While working on the DECUServe OpenVMS system I found out quickly that pressing BACKSPACE moves the cursor on the shell to the beginning of the line instead of deleting the character to the left of the cursor. This made me very aware of my typing, since when I made an error I had to retype the entire line (the terminal is in insert mode it seems). After reading through some documentation it seems that is default behaviour but there are terminal options to change it.
Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.
You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days.
OpenVMS uses the DCL shell, short for Digital Command Language. It appears that DCL is an attempt to have one shell for all systems of DEC, so that one only has to learn one shell environment usable on many systems.
I use SSH to connect to the DECUServe system and doing that from a linux computer I had no problem with backspace. As in, the backspace key removes the character left of the cursor.
From a windows system with Putty for SSH, I noticed that the Backspace key moves the cursor to the beginning of the line. The terminal is set on insert mode, so I had to retype the entire line when making a typo. The delete key was also of no help, it didn't seems to do anything.
Since I often work with network devices such as switched, I resorted to the
CTRL+H key combo. That also moved the cursor to the start of the line.
I was hoping it would remove a character.
Terminal input features
The first clue came when I read this documentation on shell features such
as go to the end or beginning of a line. Like
CTRL+E in bash
emacs mode (default).
To correct a typo when the shell is in BACKSPACE to the start of the line mode,
I used the
CTRL+J key combo. That deletes an entire word. So I pressed
backspace, ended up at the start of the line and either using the arrow keys or
CTRL+E (go to the end of the line) I went back to the typo and pressed
CTRL+J to remove the word and redo the typo.
I also found out that the DCL by default is in overwrite (insert) mode. Thas means that when you move the cursor to a place in a word and start typing, the character underneath the cursor is overwritten. The alternative (append mode) means that the characters are placed before the character under the cursor and nothing is overwritten.
To switch these modes in the DCL shell, use
CTRL+A. I was unable to find a
visual indicator to show which mode you are in. This combo also works in the
EVE editor by the way.
Not an optimal situation to be in regarding typing. It is quite cumbersome when you are used to certain backspace key behaviour.
Reading more documentation on terminal options I found the specific option I was looking for:
/BACKSPACE=keyword Controls how the system responds to the backspace key (Ctrl/H) in line editing mode. There are two possible keywords: BACKSPACE (default) --- The terminal driver returns the user to the beginning of the line. (This is the traditional way OpenVMS has always worked.) DELETE --- The terminal driver interprets the backspace key as a delete character instruction. Note the following exceptions: If the terminal is set in PASSALL or PASTHRU mode, the backspace key is not interpreted as a delete character instruction. If the user issues an IO$_READVBLK with IO$M_NOFILTR or IO$_READPBLK, the backspace key is not interpreted as a delete character instruction. You can use SYSGEN to make /BACKSPACE=DELETE the default for all terminals by setting the system parameter TTY_DEFCHAR3 to 16. If the default is set to DELETE, the user can still go to the start of a line by pressing F12 or by entering the following sequence: Ctrl/V Ctrl/H Ctrl/H.
So using the following command one can make their backspace key remove a character left of the cursor:
$ SET TERMINAL /BACKSPACE=DELETE
After which to my pleasure, the backspace key works as I want it to work. Even
EVE, the editor.
Make it last
I want this to be my default and on linux I'm used to placing stuff in the
.profile to be executed at every shell login. OpenVMS has such a
LOGIN.COM in your home folder.
On the DECUS system there already was stuff in there, so I only added my line on the most logical place. This is the specific line:
$ SET TERMINAL /BACKSPACE=DELETE
Using the EVE editor:
This is the complete file with my changes:
$! Template login.com procedure for DECUServe users. $ set noon $ ! Remove the following line if you want to use DECWindows Notes $ NO*TES :== NOTES/INTERFACE=CHARACTER_CELL $ if f$mode() .nes. "INTERACTIVE" then goto end_interactive $ ! Place commands to be executed only in interactive mode here: $ set terminal/inquire/noeightbit $ update_notebook ! Spawned update of the MAIN class in your Notebook. $end_interactive: $ ! Place commands to be executed in all modes here: $ show quota $ SET TERMINAL /BACKSPACE=DELETE $ exit
Saving it with
CTRL+Z, then logging out (with
LOG) and logging back in, my
backspace key now always is just the way I like it.