It is possible to bind specific keys to actions in a shell, e.g. binding the home key to “go to the beginning of the line”. To check the code we need to bind, one can use `Ctrl+V <key or combination of keys>` in bash or zsh. However, in Konsole, the code reported by Ctrl+V Ctrl+Backspace is `^?`, which means we can’t rebind it (same for Backspace). Konsole should probably act like GNOME terminal in this regard.
> Konsole should probably act like GNOME terminal in this regard. GNOME Terminal acts like xterm in this regard :) (https://bugzilla.gnome.org/show_bug.cgi?id=733246)
https://phabricator.kde.org/D10884 FTR, you can fine tune the behaviour using Konsole key bindings editor (Edit current profile -> Keyboard -> Edit); for example you can edit the "Default (XFree 4)" bindings: - In the table, select "Backspace" and change it to "Backspace-AnyModifier" - Add a new entry by clicking Add and use "Backspace+Ctrl" and "\b" for the "Key combination" and "Output" fields respectively.
Git commit 5345bbb0afa8edd6ba4909eca2495745df36f6a1 by Kurt Hindenburg, on behalf of Ahmad Samir. Committed on 28/02/2018 at 04:04. Pushed by hindenburg into branch 'master'. Match xterm behaviour when pressing Ctrl+Backspace Summary: Change the default keyboard translator to match xterm behaviour: - Pressing Backspace without any modifiers sends '^?', ASCII DEL character - Pressing Control+Backspace sends '^H', BS character Test Plan: - Before applying the patch pressing Ctrl+V (to insert verbatim) then Backspace, sends '^?'; the same happens with Ctrl+Backspace - With the patch: - pressing Ctrl+V then Backspace sends '^?' - pressing Ctrl+V then Ctrl+Backspace sends '^H' Reviewers: #konsole, hindenburg Reviewed By: #konsole, hindenburg Subscribers: ngraham Tags: #konsole Differential Revision: https://phabricator.kde.org/D10884 M +5 -1 data/keyboard-layouts/default.keytab https://commits.kde.org/konsole/5345bbb0afa8edd6ba4909eca2495745df36f6a1
Thanks a lot. Konsole team is awesomely reactive to my bug reports. I’m not sure how terminfo works, but this should probably be reflected in it to avoid edge cases in shell’s configurations. Ahmad, I knew I could configure that behavior but I tried and it didn’t work; this is the kind of things that are confusing as hell for people that don’t understand any of the arcane of terminal emulators. The change made by Kurt will make life a lot easier for people, because this default is the same as several other terminal emulators (references like xterm and urxvt, or the similar GNOME-terminal) and just works without drawbacks (as far as I know).
FTR, the way to configure the key bindings in konsole is documented here: https://cgit.kde.org/konsole.git/tree/data/keyboard-layouts/README.KeyTab
It should be included or mentionned in Konsole Handbook then (<https://docs.kde.org/stable5/en/applications/konsole/index.html>). Should I open another issue about it?
We can add it to the handbook - I'm never quite sure how many people use that. The Keyboard tab has a lot of space at the bottom; I wonder if something could be put there.
After a upgrading my debian stable boxes to Buster I wondered why alt+backspace stopped working in Konsole the way it used to. After a lot of trial and error I finally stumbled about this revision, which is causing this wreck. Of course, I can customise it back the way it was by reversing your changes .. Nevertheless, since the change fixed the intended behaviour but broke an other keybinding I think I need to report it here. Probably something else needs to be added to restore the alt+backspace behaviour, while also having the intended ctrl+backspace behaviour.
Could explain in more details, how did Alt+Backspace work before the update? and how does it work now?
Konsole emulates the XTerm setting "Meta sends escape" - this is pressing Alt+Backspace used to default to emulate the sequence Esc + Backspace. With the new setting now Alt + Backspace sends Esc + Alt + Backspace. XTerm does not by default enable "Meta sends escape", but it is hard-coded in Konsole.
Note also, that your change could be made as a separate profile that comes with Konsole, rather than changing the defaults that have been in shipped with Konsole since version 1.2.
Those key bindings are a major pain... :) Here's how I tested: - First xterm, I searched online and found one can use $ stty raw $ sed -n l then press the key binding, the output was: Backspace: ^? Ctrl + Backspace: ^H Alt + Backspace: ^[^? I get the same output in konsole with the current default keybinding schema; and also if I create a new schema, based on the default one, and revert the changes i.e. remove these two entries: Backspace - Ctrl Backspace + Ctrl and add the old entry before any of those changes: Backspace \x7f Apply the change and start a new konsole window (it seems there is a bug where the new keybinding doesn't get applied except for newly started instances); and I get the same behaviour.
For the whole history of these changes: https://cgit.kde.org/konsole.git/log/data/keyboard-layouts/default.keytab
I agree that this is a mess, and GNOME Terminal was also plagued by bugs in this respect in the past. Actually, KDE Konsole always seemed to better implement sane settings in XTerm (not the defaults) then GNOME Terminal. One of the reasons why I like it so much! Thanks especially to your last link, that shows what is going on. Actually it appears that in the KDE version that ships with debian buster (current stable) this commit was the last with respect to Alt+Backspace https://cgit.kde.org/konsole.git/commit/data/keyboard-layouts/default.keytab?id=5345bbb0afa8edd6ba4909eca2495745df36f6a1 When I press Alt + Backspace I get ^[^H - in later commits you have changed this again - but these changes are not in 18.04.0 that ships with debian... Is this correct? If so, then feel free to close this bug. On a side note - I can not reproduce the bug of profiles not being applied immediately. If I go to "Edit Current Profile" and change the Keyboard layout the changes are applied immediately - so this might be a regression?
Here is what I propose - the old set of defaults dates back to a long long time, as can be seen by its name... Nobody nowadays even remembers what XFree is. Still, these settings have value, and I think that these old settings should be available as a profile (which does not necessarily need to be the default). So I suggest to have a profile with those old settings (XFree) and a new default, maybe just named Default?
Just to add, as this was maybe not clear from my inital reply ^[^? is the desired alt+backspace behavior.
Using the latest .keytab from master should give the behaviour you describe; basically the two rules concerning Backspace mean: Backspace-Ctrl: will send ^? Backspace+Ctrl: will send ^H The first rule also works for Alt, i.e. pressing Backspace without Control will always send ^?. And the bug I was talking about happens if you edit a keybiding scheme, then apply, the changes don't seem to take effect in the current konsole window (I should open a bug report to track the issue, but I need to test again....).
I’m closing this as resolved since the problem I initially reported is fixed, and there was no activity for almost 4 years. Other problems mentioned in this thread should have their own bug reports, if there are still there/relevant.