-
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
Console.ReadKey
behaves differently in .NET 6 and .NET 7-preview.7 comparing to .NET 5 when TERM is set to rxvt
#75289
Comments
Tagging subscribers to this area: @dotnet/area-system-console Issue DetailsDescriptionDescriptionWe got a report in PowerShell repo about "arrow keys not functioning properly in PowerShell 7.2 with rxvt terminals", see PowerShell/PowerShell#16606. It turns out However, in .NET 6 and .NET 7-preview.7, the Note that, this issue was originally reported as #63387, which was closed as completed. However, it's not fixed in .NET 7-preview.7. Reproduction Steps
Expected behavior
Actual behaviorArrow keys are not working as expected. Regression?Yes. Known WorkaroundsSetting Configuration
Other informationNo response
|
/cc @adamsitnik |
Based on the https://github.com/dotnet/runtime/commits/v7.0.0-preview.7.22375.6 tag, it's last commit was July 25th. The fix wasn't merged until August 1st. f1de614 So it would seem the fix is not present in preview7, however I do see it in the RC1 branch. |
Please keep this issue open until it's verified fixed with RC1 release. |
@vcsjones is right, #72193 was not included in Preview 7, but it in RC 1 Now we have tests for these particular keys for rxvt and I am 100% sure they work as expected: Arrow keys and all modifiers: runtime/src/libraries/System.Console/tests/KeyParserTests.cs Lines 1088 to 1107 in 1f6ebd0
Home:
End:
@daxian-dbw RC1 is going to be released in four days (13th of September) Could you please test PowerShell with RC1 and re-open it if needed? We close all the issues once PR with a fix gets merged (it lowers the bookkeeping cost on our end). |
@adamsitnik Thanks for confirming! I opened this issue only because the original one was locked and hence I cannot ask for confirmation. I will test with RC1 once it's out. |
@adamsitnik This issue still reproduces with PowerShell built against .NET 7-RC1, on Ubuntu 18.04 WSL2. The env var Here are the observed behaviors:
This is really puzzling |
@daxian-dbw I need to attach a debugger to find out why. Is there any chance you could describe how I can repro that? (What to build and how to run |
For now I've set the milestone to 8.0.0 as I am expecting that the fix will be rather in PowerShell than in .NET. If I am wrong, we are going to fix it in System.Console and backport to 7.0 |
@daxian-dbw Is there any chance that |
If you don't need the
|
No, PSReadLine doesn't set custom terminal settings. |
@daxian-dbw I've downloaded the package and run it from Rxvt Color Unicode Terminal and everything works fine: I can use left & right arrows to move the cursor and up & down to browse the command history it works with xterm as well:
I think that the source of the problem is that you start one terminal that identifies as I am able to reproduce it with xterm: Most likely you were doing that to mimic PowerShell/PowerShell#16606 but what was needed was running an actual rxvt terminal. I am going to close the issue as I am quite confident that rxvt terminals are working as expected now. If you can run any rxvt terminal on Unix and repro the bug without setting TERM to a different terminal please re-open the issue and we are going to investigate it again. Thank you! FWIW we have released a blog post dedicated to the rewrite, you can read it here: https://devblogs.microsoft.com/dotnet/console-readkey-improvements-in-net-7/ |
@adamsitnik Thank you for the investigation and also confirming that it works on the true Rxvt terminal.
This makes a lot of sense. |
Description
Description
We got a report in PowerShell repo about "arrow keys not functioning properly in PowerShell 7.2 with rxvt terminals", see PowerShell/PowerShell#16606.
It turns out
Console.ReadKey
behaves differently in .NET 6 and .NET 7-preview.7 comparing to .NET 5 when TERM is set to rxvt.In .NET 5, the
ConsoleKeyInfo
returned forLeftArrow
doesn't has any modifiers, as shown below:However, in .NET 6 and .NET 7-preview.7, the
ConsoleKeyInfo
returned forLeftArrow
hasControl
andShift
modifiers specified, as shown below:Note that, this issue was originally reported as #63387, which was closed as completed. However, it's not fixed in .NET 7-preview.7.
Reproduction Steps
export TERM=rxvt
Expected behavior
LeftArrow
andRightArrow
should move the cursor left and right;LeftArrow
andRightArrow
should go through history commands.Actual behavior
Arrow keys are not working as expected.
Home
andEnd
printsOH
andOF
respectively.Regression?
Yes.
Known Workarounds
Setting
TERM=xterm
would makeConsole.ReadKey
work as expected withrxvt
terminals.Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: