Bug 847852 - Backspace key sends ^H instead of erasechar()
Backspace key sends ^H instead of erasechar()
Product: Fedora
Classification: Fedora
Component: rogue (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Petr Šabata
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-08-13 14:51 EDT by John Haxby
Modified: 2012-08-22 17:13 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-08-22 17:13:10 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Proposed patch (456 bytes, patch)
2012-08-13 14:51 EDT, John Haxby
no flags Details | Diff
Proposed patch, corrected (456 bytes, patch)
2012-08-13 14:56 EDT, John Haxby
no flags Details | Diff
Python test program (745 bytes, text/plain)
2012-08-14 16:24 EDT, John Haxby
no flags Details

  None (edit)
Description John Haxby 2012-08-13 14:51:31 EDT
Created attachment 604070 [details]
Proposed patch

Description of problem:
   The backspace key, the one at the top right of the keyboard that curses
   maps to KEY_BACKSPACE, sends ctrl-H rather than erasechar() so it works
   as ctrl-H not as an erasechar 

Version-Release number of selected component (if applicable):

How reproducible:
   Always, easily

Steps to Reproduce:
1. I used a konsole, different terminal emulators produce different results
2. start rogue
3. "c", "b" to call armour something, type "xxx", hit backspace key to delete
Actual results:
  Nothing happens

Expected results:
  Characters erased

Additional info:
  The problem is that in mdport.c, KEY_BACKSPACE is mapped to CTRL('H') but
  it should be mapped to erasechar().   This works on terminal emulators
  that previously worked as well as terminal emulators (like konsole) that
Comment 1 John Haxby 2012-08-13 14:56:53 EDT
Created attachment 604071 [details]
Proposed patch, corrected

The patch the right way around this time.
Comment 2 Petr Šabata 2012-08-14 10:13:59 EDT
I can reproduce this with current xterm.
Thank you for the patch, John.  It works like a charm.
Comment 3 john.haxby@oracle.com 2012-08-14 10:27:17 EDT
Actually, it doesn't.

With a Mac's terminal emulator ^H behaves as erasechar() instead of go-left-until-you-reach something.   I need to re-think the patch a bit.

It's a pity that rogue maps the KEY_* symbols to ctrl-<something> as that causes trouble like this.   I think that the handling of the backspace key for deleting characters needs to treat ^H and erasechar() as both meaning delete-previous-characters.
Comment 4 Fedora Update System 2012-08-14 10:52:05 EDT
rogue-5.4.5-9.fc17 has been submitted as an update for Fedora 17.
Comment 5 Petr Šabata 2012-08-14 10:59:28 EDT
(In reply to comment #3)
> Actually, it doesn't.
> With a Mac's terminal emulator ^H behaves as erasechar() instead of
> go-left-until-you-reach something.   I need to re-think the patch a bit.

So Mac's terminal emulator sends backspace when ^H is pressed?
Comment 6 John Haxby 2012-08-14 16:24:36 EDT
Created attachment 604444 [details]
Python test program

This is a handy little python script to see what sends what.

The original fix is correct; the problem is actually to do with terminfo entries.

To demonstrate this run

    TERM=xterm ./test.py
    TERM=linux ./test.py
    TERM=xterm-color ./test.py

With the first two, the backspace key and ^H send KEY_BACKSPACE and '\x08' respectively as they should.   With the last, however, the backspace key sends '\x7f' and ^H sends KEY_BACKSPACE.    On the Mac, xterm and xterm-color behave the same, though TERM=linux is correct.

Perversely, the unpatched rogue works with xterm-color, but the patched version does not.   Given the behaviour of the test program I'm inclined to believe the patch is still correct, not least because the backspace key does send a '\x7f' outside of curses and not ctrl-h ('\x08').
Comment 7 Fedora Update System 2012-08-14 17:57:14 EDT
Package rogue-5.4.5-9.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing rogue-5.4.5-9.fc17'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 8 Fedora Update System 2012-08-22 17:13:10 EDT
rogue-5.4.5-9.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

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