rustbox
rustbox copied to clipboard
Backspace does not work
I tried to react to a Key::Backspace in my program but I did not receive it, so I displayed the event that occurred and it was read as a KeyEvent(Ctrl('h')).
I don't know if rustbox or the underlying libraries are the problem but I will investigate further.
Tested using:
- desktop
- enlightenment (X)
- qtile (X)
- X
- none (tty) Backspace works here
- terminal
- terminology
- xterm
Control h is backspace in ASCII, so perhaps a translation is in order?
On Sun, Oct 4, 2015, 5:36 AM Katze [email protected] wrote:
Tested using:
- desktop
- enlightenment
- none (tty) Backspace works here
- terminal
- terminology
- xterm
— Reply to this email directly or view it on GitHub https://github.com/gchp/rustbox/issues/52#issuecomment-145330176.
So if I just do it like I did in this Gist everything is fine?
Interesting. What is the value of your $TERM environment variable?
echo $TERM
prints xterm.
Hmm. I've tried running this in a few different ways, and I always get the same result which is that Ctrl-h and backspace are different keys.
Can you give some more information on your environment, and what you are running to get this happening? Is the example in the gist above what you are using to re-produce this?
Sorry for the inconvenience!
The gist above is exactly what I used to test with.
I just made a new gist containing my current test program. It uses rustbox 0.7.2.
If I now run this and press the Backspace-key it prints Ctrl('h') instead of Key::Backspace.
It only behaves so when I run it under X (window manager, terminal and so on do not seem to matter at all). When I use it on a tty, everything runs fine.
I am running:
- Gentoo GNU/Linux
- kernel: 4.2.3-gentoo
- bash 4.3.42(1)-release
- X.Org X Server 1.17.2
Edit: if you need any more detailed information about e.g. compile options of these programs, just tell me.
@benaryorg just a head's up: I ran into the same issue with xterm on Arch Linux. Installing xfce4-terminal resolved the issue (it has more robust backspace handling). I also noticed that Vim has a :fixdel command to work around this sort of thing.
I'm willing to bet termbox itself exhibits this bug, although I've not yet tested it. Might be out of scope for Rustbox to fix issues with older terminals like these?
If your delete key terminal code is wrong, but the code for backspace is alright, you can put this in your .vimrc:
:fixdel
I did read the whole entry of fixdel but it does seem to fix Delete and not Backspace at least from what I understood.
Furthermore the terminal I've used first (terminology) is part of the Enlightenment project which is being actively supported, to my knowledge. At least enlightenment itself keeps having releases, as do the underlying libraries efl and elementary which are also used by terminology.
Edit: But shouldn't at least xterm be supported as it is the reference terminal emulator just about everywhere.