GNOME Bugzilla – Bug 733246
Ctrl+Backspace should send ^H
Last modified: 2015-08-16 10:26:01 UTC
In xterm, Backspace sends ^? whereas Ctrl+Backspace sends ^H. In vte, both send ^?. I guess it's subject to XTerm resources, g-t's compability (stty erase etc.) settings, and probably in case of XTerm it also depends on terminfo's kbs which AFAICT is patched by Ubuntu (or by Redhat?) from ^H to ^? or the other way around, I can't remember exactly.
I guess now that we only support xterm emulation, we should also offer exactly the (and only the) delete/backspace settings that xterm offers. So this whole delete/backspace binding stuff needs revising.
It's customizable in xterm, and I think distros / non-Linux Unixes are likely to configure these to match their stty settings.
Any news on this? I would really like to see this fixed, where would I start if I want to help?
The code is in vte's src/vte.c vte_terminal_key_press() case GDK_KEY_BackSpace... See a couple of lines below at case GDK_KEY_Insert for how to check for modifiers. The tricky part is to check what xterm does for each of the possible backspace bindings (^H, ^?, anything else???) and make sure vte does the same in all cases. It's a great chance to do some cleanup (as per comment 1) and remove the options (if any) that we support but xterm doesn't.
With different options you mean the possible enum values of terminal->pvt->backspace_binding? Does xterm support any options for this? After googling I found that xterm always sends ASCII backspace, is this correct?
(In reply to Jan Niklas Hasse from comment #5) > With different options you mean the possible enum values of > terminal->pvt->backspace_binding? Exactly. Along with different values of "stty erase", if/whenever relevant. > Does xterm support any options for this? After googling I found that xterm > always sends ASCII backspace, is this correct? The backarrowKey, backarrowKeyIsErase, ptyInitialErase settings seem to be relevant. (Er... did you mean the backspace key without modifier, or with Ctrl?) We'd need to investigate to understand the situation much better. Thanks in advance if you're willing to contribute to this! :)
Created attachment 301445 [details] [review] Fix xterm seems to toggle the Backspace key's behavior between ^H and ^? when Ctrl is pressed. I've added this toggling feature. For the Delete key, it can emit ^? or an escape sequence, but Ctrl is ignored here, ^? remains ^?. We have more options for the Delete, e.g. it can generate ^H which might not ever be needed, dunno. Seems our code aims for feature parity between the two keys, yet the code that implements them differs. Not sure if it makes more sense to go for complete parity (and make Delete also toggle on Ctrl), or go for xterm-like approach and drop some of the features. Or probably just leave it as is for now :)
Cool, this is all I need, thanks! I couldn't get gnome-terminal's master branch to compile on my machine to test it, but I can't wait when this hits distributions (so 2017 I guess :D)
2016 is a better bet :)
*** Bug 420039 has been marked as a duplicate of this bug. ***
Thanks for that patch, working nicely here.
*** Bug 752540 has been marked as a duplicate of this bug. ***
Fixed