-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[System.Console]::ReadKey()
returns escape sequence characters when pressing arrow keys in PowerShell on Linux
#75305
Comments
Tagging subscribers to this area: @dotnet/area-system-console Issue DetailsDescriptionThis is with PowerShell 7.3.0-preview.3, which runs on top of .NET 7-preview.7. Running However, when using Reproduction Steps
Expected behavior
Actual behavior
However, when using Regression?Not as far as I know. I observe the same behavior in .NET 6. Known WorkaroundsNo response Configuration
Other informationNo response
|
Is this also addressed by f1de614? |
Is there any chance PowerShell could set
I am not 100% sure as I don't know what caused the difference in first place. Could you please test it with RC1? |
PowerShell doesn't set
The PSReadLine module running in PowerShell depends on |
@daxian-dbw RC1 was shipped yesterday, could you please check if it works as expected now? |
Thanks @adamsitnik, we are preparing a release targeting RC1. Will verify this soon. |
This is fixed with the .NET 7-RC1 release ❤️ Thanks @adamsitnik! |
Based on #75289 (comment) it looks that I'll have to solve this mystery anyway ;) |
@daxian-dbw thanks for testing it and letting me know! |
Description
This is with PowerShell 7.3.0-preview.7, which runs on top of .NET 7-preview.7.
Running
[System.Console]::ReadKey()
in PowerShell, and then press UpArrow, it returns the escape sequences character by character --Escape
and thenA
.It's the same to other arrow keys: DownArrow, LeftArrow, RightArrow
However, when using
Console.ReadKey
in an EXE built against .NET 7-preview.7, it returnsUpArrow
(and other arraow keys) as expected. Any ideas about what may cause this difference?Related PowerShell issue: PowerShell/PowerShell#16443
Reproduction Steps
[System.Console]::ReadKey()
Expected behavior
[System.Console]::ReadKey()
returns aConsoleKeyInfo
with those values:KeyChar: 0, Key: UpArrow, Modifier: 0
Actual behavior
[System.Console]::ReadKey()
returns aConsoleKeyInfo
with theEscape
key, and then a secondReadKey
returnsA
However, when using
Console.ReadKey
from an EXE that's built against .NET 7-preview.7, it works as expected:Regression?
Not as far as I know. I observe the same behavior in .NET 6.
Known Workarounds
No response
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: