Bug 847852 - Backspace key sends ^H instead of erasechar()
Summary: Backspace key sends ^H instead of erasechar()
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rogue
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Šabata
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-13 18:51 UTC by John Haxby
Modified: 2012-08-22 21:13 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-22 21:13:10 UTC
Type: Bug
Embargoed:


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

Description John Haxby 2012-08-13 18:51:31 UTC
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):
   rogue-5.4.5-7.fc15.x86_64

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
  didn't.

Comment 1 John Haxby 2012-08-13 18:56:53 UTC
Created attachment 604071 [details]
Proposed patch, corrected

The patch the right way around this time.

Comment 2 Petr Šabata 2012-08-14 14:13:59 UTC
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 14:27:17 UTC
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 14:52:05 UTC
rogue-5.4.5-9.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/rogue-5.4.5-9.fc17

Comment 5 Petr Šabata 2012-08-14 14:59:28 UTC
(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 20:24:36 UTC
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
and
    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 21:57:14 UTC
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:
https://admin.fedoraproject.org/updates/FEDORA-2012-11868/rogue-5.4.5-9.fc17
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2012-08-22 21:13:10 UTC
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.