Skip to content
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 returns unexpected ConsoleKeyInfo when pressing Shift+End in WSL (v2 Ubuntu 20.04) #63644

Closed
daxian-dbw opened this issue Jan 11, 2022 · 1 comment · Fixed by #72193
Assignees
Milestone

Comments

@daxian-dbw
Copy link
Contributor

daxian-dbw commented Jan 11, 2022

Description

This affects functionality of PSReadLine: PowerShell/PSReadLine#3126

When pressing Shift+End, [console]::ReadKey($true) returns Escape as the ConsoleKeyInfo value, and triggers the 1;2F input from terminal. This is on WSL v2 with Ubuntu 20.04. The value for environment variable TERM is xterm-256color.

image

Note that, Ctrl+End, Alt+End, Ctrl+Home, Alt+Home, and Shift+Home are all work as expected. For example, Shift+Home returns:

image

Reproduction Steps

  1. Run [console]::ReadKey($true), for example, from PowerShell
  2. Press the keystrokes Shift+End

Expected behavior

The returned ConsoleKeyInfo should be:

KeyChar  Key Modifiers
-------  --- ---------
         End     Shift

Actual behavior

returns Escape as the ConsoleKeyInfo value, and triggers the 1;2F input from terminal.

image

Regression?

Not sure. At least the same behavior is found on .NET 5 as well.

Known Workarounds

Unkown.

Configuration

  1. .NET: this repros on both .NET 6 and .NET 5.
  2. OS: Ubuntu 20.04, WSL v2
  3. Architecture is x64

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Console untriaged New issue has not been triaged by the area owner labels Jan 11, 2022
@ghost
Copy link

ghost commented Jan 11, 2022

Tagging subscribers to this area: @dotnet/area-system-console
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

When pressing Shift+End, [console]::ReadKey($true) returns Escape as the ConsoleKeyInfo value, and triggers the 1;2F input from terminal. This is on WSL v2 with Ubuntu 20.04. The value for environment variable TERM is xterm-256color.

image

Note that, Ctrl+End, Alt+End, Ctrl+Home, Alt+Home, and Shift+Home are all work as expected. For example, Shift+Home returns:

image

Reproduction Steps

  1. Run [console]::ReadKey($true), for example, from PowerShell
  2. Press the keystrokes Shift+End

Expected behavior

The returned ConsoleKeyInfo should be:

KeyChar  Key Modifiers
-------  --- ---------
         End     Shift

Actual behavior

returns Escape as the ConsoleKeyInfo value, and triggers the 1;2F input from terminal.

image

Regression?

Not sure. At least the same behavior is found on .NET 5 as well.

Known Workarounds

Unkown.

Configuration

  1. .NET: this repros on both .NET 6 and .NET 5.
  2. OS: Ubuntu 20.04, WSL v2
  3. Architecture is x64

Other information

No response

Author: daxian-dbw
Assignees: -
Labels:

area-System.Console, untriaged

Milestone: -

@adamsitnik adamsitnik self-assigned this Jul 7, 2022
@adamsitnik adamsitnik added this to the 7.0.0 milestone Jul 7, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 7, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 14, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 1, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants