-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Sequence CTRL+\ is not detected in some keyboard layouts #8458
Comments
I'm using the UK extended layout so yes it has an AltGr key. I tried |
I am having the same problem with third party Colemak layout. Can't figure out why it's not passing through. In my case, I am trying Ctrl+_ (undo in Emacs). showkey also shows no input. |
I'm aware that this isn't a high priority issue since very few users should be affected. But it's quite annoying to me because it prevents me to use some features of my editor of choice (the built-in terminal of Neovim). I would like to take a look at the code and maybe try to find the issue myself. @zadjii-msft could you tell me where I should start looking? |
The best place to start looking will be in Terminal.cpp's If you'd like to give us a quick debug trace, would you mind following the "input log" trace steps in this issue comment? Type out a couple Ctrl+\ sequences and send a screenshot (so we can see which records are red and which are not) Thanks! |
I've checked the source and it seems it's due to this particular line:
That function returns 0 meaning that the given vkey (here 220) has no associated Unicode character. And this is what we see in the screenshot when we use UK extended layout: However what I don't understand is that when I switch to the standard UK layout, I see the same vkey but a different value for the unicode character: I'd expect that for the same vkey + scan code we would get the same Unicode character... what is happening there? |
You know, that's a good question. I don't know what's happening there. Maybe @lhecker might? |
I'll look into it. 👍 |
@ojroques We use @zadjii-msft This issue occurs, because some non-US keyboard layouts apparently do not contain Ctrl-key mappings at all: In fact it turns out that the affected keyboards layouts don't contain any mappings for Ctrl-key combinations. It appears as if Windows simply defaults a combination of Ctrl and any A-Z key to ^A-^Z, if the current keyboard layout has no mappings itself. |
Triaged into 1.7 since we've got our best people looking at it. 😄 |
Pressing Ctrl+\ produces `^\` using the US keyboard layout, thanks to Ctrl-key mappings inside the keyboard layout, whereas some layouts, like the UK extended layout, don't contain those. This causes the character value to be zero and previously caused no VT sequence to be generated under these situations. This PR employs `MapVirtualKeyW` to infer the missing characters. As a side effect this PR effectively causes _all_ major keys on the keyboard to produce Ctrl+combinations now. ## PR Checklist * [x] Closes #8458 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests passed ## Validation Steps Performed Compared all major keys in combination with Ctrl with the app store version of Terminal using `showkey` in WSL. All keys that previously worked still appear to continue to work.
Dustin L. Howett (3) * Move CharToKeyEvents (and friends) into InteractivityBase (GH-9106) * Update Cascadia Code to 2102.03 (GH-9088) * verison: bump to 1.7 on main Josh Soref (1) * ci: update to Spell check to 0.0.17a (CC-9014) Leonard Hecker (3) * Fixed GH-5205: Ctrl+Alt+2 doesn't send ^[^@ (CC-5272) * Fix issues in tests.xml and OpenConsole.psm1 (CC-9011) * Fix GH-8458: Handle all Ctrl-key combinations (CC-8870) Mike Griese (1) * Add support for running a commandline in another WT window (GH-8898) Michael Niksa (1) * Teach the renderer to keep thread alive if engine requests it (GH-9091) Lachlan Picking (1) * Fix shader time input (CC-8994) PankajBhojwani (1) * Separate runtime TerminalSettings from profile-TerminalSettings (CC-8602) Chester Liu (2) * Add support for paste filtering and bracketed paste mode (CC-9034) * Add support for chaining OSC 10-12 (CC-8999) Related work items: MSFT-31692939
🎉This issue was addressed in #8870, which has now been successfully released as Handy links: |
I have similar issue with french layout and ctrl+_ not correctly passed to the linux applications but as it can be reproduced within any other windows terminals I tried, i guess it's more a wsl issue. I opened an issue on WSL github repo : microsoft/WSL#11041 |
@XL64 That sounds like #11194, which should have been fixed in the v1.20 preview release. I've just done a test with a French keyboard layout in WSL, and Ctrl+_ is definitely working as expected for me. If you can still reproduce the issue on version 1.20, it's best you open another issue and provide more details. |
Indeed, it is fixed. what is strange is that other native windows terminal are affected too. |
Environment
Edit: I've updated the description.
Here is the old one.
Steps to reproduce
CTRL+\
in an application: for instanceCTRL+\ CTRL+n
in Neovim to quit the built-in terminal or by adding a new mapping in tmux.Actual behavior
Nothing happens. It seems the
CTRL+\
sequence is completely ignored by Windows Terminal. I'm using WSL1 with Ubuntu 20.04 but I've tried in Powershell and same issue. I've also tried with another terminal emulator (kitty) andCTRL+\
works fine there.I found maybe related issues: #1288, #521 but they are marked resolved and I'm still getting the bug. Any idea why?
Steps to reproduce
showkey -a
(I'm using Ubuntu 20.04 in WSL)Actual behavior
Nothing happens. The CTRl-\ sequence goes undetected by the terminal. I've tried different layouts (US and French) and it works fine, so this issue seems tied to the choice of the keyboard layout.
Expected behavior
CTRL-\ is correctly detected. Maybe related issues: #1288, #521.
The text was updated successfully, but these errors were encountered: