Open 243083df opened 3 years ago
What keyboard layout are you using?
Russian (Russia) https://docs.microsoft.com/en-us/globalization/keyboards/kbdru
@iSazonov Are you able to reproduce this issue?
No. The same PSRL 2.1.0 but PS 7.2:
Thank you @iSazonov! You were using the Russian Keyboard, right?
I come back with mysterious addition.
When open PS and CTRL+C
(Cyrillic), PS react like Cyrillic C
entered. And when do CTRL+C
just add c
, and CTRL+Ф
add 'ф', but if i switch layout to ENG, and input a
then a
will be added, but when i press CTRL+A
then PS treat A
as russian ф
Thank you @iSazonov! You were using the Russian Keyboard, right?
Yes, and I switched to Russian layout.
Windows Terminal versionI I tested with is latest Preview 1.11.2421.
@243083df Given that @iSazonov couldn't reproduce the issue using Russian Keyboard, we need more information on the repro steps. Can you be more specific on what keyboard you are using, what display language and default language, as well as what additional software you installed that you think may affect the language input on your machine?
I debugged this problem and found what user32.dll works only with one locale with that it started.
https://github.com/PowerShell/PSReadLine/blob/master/PSReadLine/Keys.cs#L150
Since if you start PSReadline and press english CTRL+any
then ToUnicode always return english chars in chars
.
And if you (re)start PSReadline and press cyrillic CTRL+any
, ToUnicode always return cyrillic chars in chars
.
user32.dll has version 10.0.19041.1202
Bug wont reproduce on ubuntu 20.04 LTS under WSL2. Same PC.
I am debug further and find out that
https://github.com/PowerShell/PSReadLine/blob/master/PSReadLine/ReadLine.cs#L103
With ctrl return in KeyChar
not ascii code, but alphabelic so CTRL+C become 3 '\u0003'
and char.IsControl
at https://github.com/PowerShell/PSReadLine/blob/master/PSReadLine/Keys.cs#L231
return true
Console.ReadKey();
return same result so seems thats it used to readkeys
This is a duplicate of https://github.com/PowerShell/PSReadLine/issues/1393. You may also take a look at my previous attempt at fixing this, PR https://github.com/PowerShell/PSReadLine/pull/1848.
For the record, this still 100% reproduces for me using PowerShell 7.2 and any Windows Terminal (or conhost for that matter), on all of my Windows 10 and Windows 11 computers.
Stable repro (PSReadLine 2.4.0-beta0): https://github.com/microsoft/terminal/issues/17197#issuecomment-2478641782
Environment
Steps to reproduce
Open powershell 7.1.4 in windows terminal. In cyrillic keymap press CTRL+С (C cyrillic) CTRL not working and terminal show C CTRL+A and CTRL+C not working after it in both keymaps
There is also another cases but it hard to reproduce.
Expected behavior
Actual behavior
CTRL+C working correctly