Skip to content

Console.ReadKey returns unexpected ConsoleKeyInfo when pressing Shift+End in WSL (v2 Ubuntu 20.04) #63644

Closed

Description

@daxian-dbw

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

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Jan 11, 2022
  2. self-assigned this
    on Jul 7, 2022
  3. added this to the 7.0.0 milestone on Jul 7, 2022
  4. ghost removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 7, 2022
  5. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Jul 14, 2022
  6. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Aug 1, 2022
  7. ghost locked as resolved and limited conversation to collaborators on Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions