Red Hat Bugzilla – Bug 847852
Backspace key sends ^H instead of erasechar()
Last modified: 2012-08-22 17:13:10 EDT
Created attachment 604070 [details]
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):
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
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
Created attachment 604071 [details]
Proposed patch, corrected
The patch the right way around this time.
I can reproduce this with current xterm.
Thank you for the patch, John. It works like a charm.
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.
rogue-5.4.5-9.fc17 has been submitted as an update for Fedora 17.
(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?
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
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').
* 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).
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.