Ctrl + H is misbehaving. #676
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Ctrl + H is not having the desired effect. I have a key bind set for it in Vim, but it's having the same effect as Backspace. The same key bind in tmux is not functioning either.
Environment
OS: macOS 15
Terminal Version: 1.1.1
@theteachr I have this exact same issue.
I am experiencing the same issue. Does anyone have an idea how that could be debugged?
Update: I suspect this might have something to do with the keymaps defined in these files:
since they specify some specifc treatment of ctrl-h.
I did look around a bit more and managed to find a fix that does not require modifications to cool-retro-term or qmltermwidget. I am writing it down here in case it helps someone. The fix relies on the fact that qmltermwidget allows to define an alternative directory for keytabs via an environment variable (see here). To avoid Ctrl+H behaving like backspace, do the following:
/usr/local/share/crt_keytabs/default.keytab
(on my machine, the default keytab is the one that is picked up)/etc/environment
or make it available to your environment in another way:KB_LAYOUT_DIR=/usr/local/share/crt_keytabs
default.keytab
by this one:key Backspace -Control : "\x7f"
Maybe the above helps someone. FYI @Swordfish90. I haven't yet tried whether it works for the appimage, too, but I would think so. You could, of course, replace
/usr/local/share/crt_keytabs/default.keytab
by any other directory you want.The background I could find out in case it is interesting for someone, it was for me:
It seems as if terminals can send two different signals indicating backspace, Ctrl+H (also called
^H
or\x08
in hex or\b
) or Ctrl+Backspace (also called^?
or\x7f
in hex). Different terminals handle things differently. You can find that out by runningshowkey -a
and hitting backspace, end with Ctrl+D, which I did on my machine for a few:I've read somewhere that xterm used ^H, but the ones I have access to do not seem to do that. It looks like more terminals send ^? than ^H, which means it could maybe make sense to do the same for cool-retro-term 🤷. I did learn a lot about terminals while looking through the code, maybe this is interesting for someone else, too.
Sorry, that was too quick. It seems like the environment variable is overwritten here. One resolution could be to only overwrite the environment variable if is not yet set.
UPDATE: PR suggesting a small workaround is open here.
Look for
default.keytab
on your computer. On my computer it's located at:/usr/lib/aarch64-linux-gnu/qt5/QMLTermWidget/kb-layouts/default.keytab
This file specifies how the backspace key is handled. By default it emits ^H, and when hit Ctrl-backspace it emits ^?. This is important because it also sets your erase key to ^H. You can verify this by doing:
stty -a | grep erase
When your terminal is set this way, vim, or emacs, or tmux is going to treat ^H as the erase key, and not a literal ^H. If you edit the keytab file @razziel89 suggests, this will change. If you can't find the keytab file, or don't feel like editing the keytab file, you can simply do:
stty erase ^?
This will fix ^H so it works, but you'll need to press C-backspace whenever you want to get a backspace in your shell, or you'll just see a ^H on the screen. If you change your keytab file,
stty erase
will automatically be set to ^?.I had the same issue. It's even more a problem for me because I'm using CRT to login to OpenVMS systems remotely and they don't have a DEL key (it just re-renders the previous line), only Backspace which needs to send ^?. Without changing it, I needed to use ctrl-shift-backspace to erase a character.
My system keeps the keytab at /usr/lib64/qt5/qml/QMLTermWidget/kb-layouts/default.keytab. Setting
key Backspace -Control : "\x7f"
fixes the problem. Now uxterm, urxvt, and CRT all send (backspace at top, delete key next):
Maybe a small note in the documentation could save people some time.