microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.66k stars 8.33k forks source link

Terminal CTRL key is not working properly if Terminal was launched while Windows input language set to Russian #14318

Closed Kadeluxe closed 1 year ago

Kadeluxe commented 2 years ago

Windows Terminal version

1.15.2874.0

Windows build number

10.0.19045.0

Other Software

No response

Steps to reproduce

  1. Set keyboard layout to Russian;
  2. Launch Windows Terminal;
  3. Try to press CTRL+C, CTRL+Z, anything while holding CTRL, for example, hold CTRL and press QWERTY.

Expected Behavior

CTRL key shortcuts work (CTRL+C, CTRL+U, etc)

Actual Behavior

Holding CTRL and pressing keys prints Russian letters instead of treating it as a shortcut. Even if I switch to English layout, CTRL + \ prints that letter from Russian layout.

In other words, if I launch WT while Russian layout is active, and then try to press CTRL+QWERTY inside Terminal, Terminal instead prints йцукен (these are Russian layout letters of the QWERTY keys) and it doesn't work like a shortcut at all.

WindowsTerminal_aEBahR2AW4

zadjii-msft commented 1 year ago

~Are any of Ctrl+QWERTY bound in you settings? The terminal typically avoids binging anything to Ctrl+key directly, and we prefer Ctrl+shift+key instead.~

wait what, watching through to the second half of that gif, that's nuts.

Does this repro in PowerShell only, or does this happen in a Comman Prompt tab too?

Any idea if this is a recent regression? Did you happen to notice it on previous versions?

Kadeluxe commented 1 year ago

It seems that it only affects modern (?) PowerShell inside Windows Terminal. I use latest PowerShell now (7.3.1), it's still there.

I think I observed this for the first time months ago, like more than 6 months or something, maybe even more. I haven't used WT much so I forgot about it. Meanwhile I reinstalled the system, the gif in the first post is from pretty much fresh Windows installation.

Actually I tried to launch "Developer PowerShell for VS 2022" and there is no issue here. That PS version is 5.1.19041.2364 though. Not sure then, is it a PowerShell issue?

Just to be clear: it's not tied to QWERTY keys. Any key prints a respective character from Russian layout, despite input language being set to English.

zadjii-msft commented 1 year ago

That sure DOES sound like a PowerShell issue to me! Especially if it doesn't repro on 5.x, but does on 7.x.

There's probably two good places to report this, depending on a simple test. If you do a Remove-Module PSReadline, and the issue goes away, I'd report it to https://github.com/PowerShell/PSReadLine. Otherwise, I'd report this to https://github.com/PowerShell/PowerShell.

Thanks for following up!

Kadeluxe commented 1 year ago

It indeed starts to work if I do Remove-Module PSReadline. Interesting, thanks for clarifying! Actually found this: https://github.com/PowerShell/PSReadLine/issues/2865