-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect keycode for "CTRL+H" in Windows Terminal #5957
Comments
I'm not sure, but there may be this issue with app that uses PDCurses.
In the old days, no backspace key on keyboard, and ctrl + H (^H) was used to input the control character backspace(08). The control key is a key for input control characters. |
So, yes. We placed the Windows encoding for Ctrl+H on the sacrificial altar when we fixed Ctrl+Backspace. We've got plans in the works that'll make this better. Thanks. |
For reference, this will be part of #4999. |
Thanks for including this in milestone 1.1, Vim doesn't require PDCurses, it uses Win32 console APIs directly. You may say PDCurses and old console apps have bugs for this, but why Try this:
and press CTRL+H. At least, Windows Terminal should not break msvcrt, isn't it ? |
@DHowett , the xterm app you are using are too old, you can try one of:
Most modern terminal apps send XShell's default: PuTTY's default: Terminal.app's default: iTerm2's default: I think I made my point. |
@skywind3000 None of those configures what ctrl+backspace does, which is the issue we are discussing. I know that backspace is configurable. |
I tested this running cmd prompt in Windows Terminal, thought it might be useful here. That keyboard section of the table is what I typed. The common section of the table is what is "correct" for that keycode - not necacerily the most common usage.
Following the pattern that ^a ^b ^c are 0x1 0x2 and 0x3, I would assume that ^h would be 0x8, it is not. ^h should be identical to Backspace. These kinds of "errors" appear to happen with other keys as well. This isn't always a bad thing as keyboards keys meanings do evolve over time. And for correct usage the key may have to change what it represents. However here is what I think the "correct" table would be:
^Backspace and ^Delete don't have a standard for what the should be as far as I know. EDIT: My markdown was broken.
(I can't test ^V for obvious reasons) |
objection, I use CTRL+h and BackSpace in vim for different purpose, |
I didn't mean that it should be backspace I was just saying that due to the way the Control key works Ctrl+H ends up being hex 8 which is back space. The ctrl key wasn't intended to be used the way it is today and that causes issues. It was intended for entering control codes. If you look at Unicode chart 0 Now look at this:
See the pattern? To make it clear: Another example if you need it: I'm not on either side of the argument, just pointing out what you seem to have missed and that is what the control key actually does. |
Though of something. Here it is: This causes issues using Ctrl for shortcuts as you don't want the control code as the key does, you want your shortcut. I'm not saying this is the right thing to do, but it's what is done. |
A single sample which fail with |
Is there a fix or a way to remap this in the future planned? I wanted to switch over to Windows Terminal as my main terminal client, but unfortunately this breaks my ability to use backspace on our Huawei routers over Telnet. When I am able to reconfigure it (like PuTTY using Control-?(127) instead of Control-H, the backspace works fine in the Huawei telnet connections. Any update on this? |
Hi, I had the same problem and solved it using this custom setting:
|
Oh, I didn't know that such simple setting can solve the problem. I added the following lines in my settings.json, and works fine.
|
Not all heroes wear capes, you are my hero today sir :) |
I have a question for Unix folks: Is it important that |
Unfortunately using this command with PowerShell or cmd.exe will remove the entire word when using backspace instead of removing one character at a time. Not exactly ideal. If only we could configure the backspace command per profile instead of globally. |
I came here because I use Ctrl+H to move to the left pane in tmux and vim, and I use Ctrl+Backspace to delete a word backwards. I am used to making adjustments to ensure that all three work. The way to make this work for Windows Terminal (which is growing so well and I no longer try to run Alacritty on windows anymore, and haven't ran Putty in years) to be consistent with what I believe to be the ideal modern Linux and BSD mapping of these keys:
I'm not sure what Also, It's a bit surprising to me that my Delete and Ctrl+Delete keys worked out of the box in tmux over ssh. Funny that those worked transparently when Ctrl+Backspace didn't. Anyway this is why standards are good because it's impossible for computers to effectively talk to each other when details are not nailed down. |
just as a tldr: Seems like this thread forked off to track a different issue. Originally, it was tracking that Ctrl+H didn't behave as expected in See also: |
this can be closed now, Ctrl+h works fine in vim now. |
Environment
Steps to reproduce
Expected behavior
The previous "aaaaa" should get deleted (CTRL+H in vim's insert mode will delete previous character), just like running vim.exe in the traditional
cmd.exe
window.Actual behavior
"CTRL+h" inserts some strange characters: "ÎzÎzÎzÎzÎzÎzÎz"
after some inspection, I located the difference, if I use
getch
inmsvcrt.dll
to display keycode:Both "CTRL+H" and "BackSpace" are
b'\x08'
, vim.exe works fine with it .Now, "CTRL+H" becomes
b'\x7f'
in Windows Terminal, which is different from running cmd.exe directly without windows terminal, and that difference breaks some terminal softwares like vim.exe .The text was updated successfully, but these errors were encountered: