Dan Mick's Little Shop of Hints

« Previous month (Sep 2006) | Main | Next month (Nov 2006) »
20061020 Friday October 20, 2006

Making backspace be your default delete character

One consistently-annoying thing about Solaris is the default terminal control-character settings, which cause Backspace *not* to erase a character in most shells (without someone somewhere executing an "stty erase ^H" to fix it up). I'm not going to claim that the default is rational, or try to speculate about where it arises, although I will say that it's being looked at.

However, today, we discovered that it's relatively easy to change; the initial control-character settings are set up by the ldterm module (the "line-discipline" is the one that establishes all the normal character-editing modes that many shells use when using "cooked-mode" terminal I/O). ldterm, it turns out, reads them from a property in the /kernel/drv/options.conf file, called ttymodes. It's encoded, but it represents the full termio settings, as stty -g would output them. The default looks like this:

ttymodes="2502:1805:bd:8a3b:3:1c:7f:15:4:0:0:0:11:13:1a:19:12:f:17:16";

If you change that 7f (the ASCII code for Del) to 8 (the ASCII code for Backspace), and reboot, then Backspace works as you expect, as soon as you log in, in all shells, thank you very much, the way God intended. ( Oct 20 2006, 05:34:12 PM PDT ) Permalink Comments [4]

Calendar

RSS Feeds

Search

Links

Navigation

Referers