Bug 17020 - Backspace key disfunctional
Backspace key disfunctional
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
6.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-08-27 20:10 EDT by degraaf
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-08-28 22:27:49 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description degraaf 2000-08-27 20:10:40 EDT
I've installed yet another RedHat 6.2 system and have again run afoul
of the Great BackSpace Key Fiasco.

This fresh-out-of-the-box system has this aggravating behaviour:
I type a long command, but make an error.  I backspace to correct it,
but instead of removing the mis-typed character, the entire line is deleted
and I have to type it all again.  I am a sloppy (but fast) typist and
this renders the system all but unusable.

Can we not all agree that the BackSpace key has God's intended
purpose of removing the last typed character, allowing it to be
retyped?

Can anyone give me a single rational reason why I should like the
present RedHat behaviour?

Red Hat!  Are you listening?  Please fix this BEFORE you issue another
release!  Fix it on the command line.  Fix it in X.  Fix in in
applications.  Fix it EVERYWHERE.

Yes, I know how to fix it myself.  But why should I have to???
Comment 1 Bernhard Rosenkraenzer 2000-08-28 04:03:23 EDT
I can't reproduce this on all the 6.x and pre-7.0 systems we have.
Which keyboard layout are you using, are you working locally or remotely, what
does "echo $TERM" say, ...
Are you sure the "Alt" key on your keyboard isn't stuck? Alt + Backspace is
supposed to delete an entire line. It's possible that some odd keyboard layout
nobody else is using maps backspace to Alt + Backspace, but I don't think so...
Comment 2 degraaf 2000-08-28 22:27:47 EDT
You are correct, of course.  I apologize for misstating my complaint.
The Backspace key does appear to work correctly in a newly created RH6.2
system.  It is the Delete key that is broken; and when I fix that, the
Backspace key becomes broken.

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:
$ 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 actually is 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', 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 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 k
eys"
    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  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) \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
different 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...

Anyway, I'm not sure what I'm asking you to do.
Maybe provide an option for UNIX SysV-like behaviour;
maybe just some documentation of how to do it;
perhaps starting with some commentary on how I've done it
and what I've left undone.
Comment 3 Bernhard Rosenkraenzer 2000-08-30 07:30:12 EDT
The delete key does just what it's supposed to do: delete the character the
cursor is on.
This is the default behavior on Linux and virtually all other operating systems
at least on x86.

Doing anything else would be VERY confusing to newbies.

I'll look into adding a script to change the settings though; I do realize that
your settings make more sense to people who are used to this way of doing
things.
Comment 4 Bernhard Rosenkraenzer 2000-08-30 07:34:19 EDT
By the way, there is actually documentation on inputrc.
Try "info readline", then select the menu entry "Command Line Editing", then
select "Readline Init FIle"
(Yes, I prefer man pages, too)

Note You need to log in before you can comment on or make changes to this bug.