[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Backspace key

John Aldrich wrote:
> On Sun, 27 Aug 2000, David A. De Graaf wrote:
> > I've installed yet another RedHat 6.2 system and have again run afoul
> > of the Great BackSpace Key Fiasco.
> >      [snip]
> I'm using 6.2 and here it only deletes the last character.
> Perhaps your keyboard repeat rate is set too high?
> 	John

I complained incorrectly that RedHat delivers a system with a broken
Backspace key, and I apologize for my misstatements.  That's because I
had installed some, but not all of my edits to change the Delete and
Backspace key behaviour to be like UNIX SysV.

It is true that Backspace seems to work in a freshly installed RedHat
6.2 system.  But Delete doesn't, and fixing Delete makes Backspace
not work. 

Delete merely beeps; I want it to be useful, specifically
to cancel a partly entered command line, and more importantly, to kill
a running process.  (The two are virtually the same thing.)

As delivered, in both console and xterm screens:

$ stty -a
speed 9600 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;

and running od -c to display what is actually emitted to stdin:
  Backspace key		=>  nothing
  Delete key		=>  \033[3~
  ^C			=>  kills the process

This is not what I want.
I want the Delete key to emit '0x7f' (often displayed as ^?), and
the Backspace key to emit ^H, and the stty settings to be
  stty  intr ^?  quit ^C  erase ^H  kill ^U

With this setup, the Backspace key (^H) still removes the last typed
character, but the Delete key (^?) terminates a running process.
The ^C terminates a process AND produces a core dump.
(You will recognize this as normal UNIX Sys V behaviour.)

I've just discovered the documentation for  readline  while searching
frantically for any information about /etc/inputrc (there isn't any!).
A quick scan suggests this is a prime candidate for the Most Unneeded
Invention of recent history. 
I do NOT wish to edit command lines with some funky DOS-like scheme
that requires me to move my fingers from the typing position.
The shell provides vi-style editing of the command line which does
everything that I can conceive of ever wanting, and has done so for
many years.

Here's what I've done to "fix" things:

Edit /etc/bashrc to add
    stty  intr ^?  quit ^C  erase ^H  kill ^U

Edit /etc/rc.c/rc.local to add
    #  Fix Backspace and Delete keys
    echo "rc.local: Restoring God's intended functions to Backspace and Delete keys"
    echo "keycode 14=BackSpace" | loadkeys
    echo "keycode 111=Delete"   | loadkeys

Edit /etc/inputrc to add:
    # Set vi editing mode - dad
    set editing-mode vi

That fixes the console screen operation, but for xterm there's more:

Edit /usr/X11R6/lib/X11/app-defaults/XTerm to add
    !   dad's preferences
    !   BackSpace key emits ^H;  Delete key emits ^?
    !   ^H is erase;  ^? is intr;  ^C is quit (with core);  ^U is kill
    !   Must also add stty line to /etc/bashrc

    xterm*ttyModes          :       erase ^H  intr ^?  quit ^C  kill ^U

    xterm*background        :       azure
    xterm*foreground        :       black

    xterm*VT100.Translations:   #override \n\
	<KeyPress>Prior :       scroll-back(18,line) \n\
        <KeyPress>Next  :       scroll-forw(18,line) \n\
        <Key>BackSpace  :       string(^H) \n\
        <Key>Delete     :	string(0x7f)

That seems like a lot to go thru, and only God knows what else remains
broken.  It seems like a really bad design choice to allow every
X application to define Backspace and Delete differently.
If I were controlling things, there would be exactly one place where
these functions were assigned.

That's the way it was, once upon a time...

	David A. De Graaf    DATIX, Inc.    Hilton Head Is., SC  
	degraaf rhsnet com       843-785-3136, -3156 (fax)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]