Skip to content

Console.ReadKey returns incomplete VT sequences for bracketed paste #60101

Closed

Description

@daxian-dbw

The Bracketed Paste Mode can be enabled by writing \e[?2004h to STDOUT on a terminal that supports the mode. When pasting text with the Bracketed Paste Mode turned on, the terminal will wrap the copied text by the start sequences \e[200~ and the end sequences \e[201~.

Today, Console.ReadKey returns a set of VT sequences for the start/end of bracketed paste.
As is shown in the below screenshot, when pasting the letter C in WSL 2 with Windows Terminal (either by Ctrl+Shift-v or right-clicking), Console.ReadKey returns "\e200~C\e201~". It's essentially the expected start/end sequences for bracketed paste, but [ is missing from both.

Question 1: Is it a bug that [ is missed from the VT sequences returned by Console.ReadKey?
Question 2: Is the current behavior of Console.ReadKey regarding Bracketed Paste Mode supposed to be reliable or it just happens to work this way? Can an application depend on today's behavior to handle bracketed paste (e.g. powershell)?

Related PowerShell issue: PowerShell/PSReadLine#1471

image

Activity

  1. ghost added
    untriaged
    on Oct 6, 2021
  2. daxian-dbw commented on Oct 7, 2021

    @daxian-dbw
    ContributorAuthor
  3. added
    needs-further-triage
    and removed
    untriaged
    on Oct 9, 2021
  4. added this to the 7.0.0 milestone on Oct 9, 2021
  5. jeffhandley commented on Jul 9, 2022

    @jeffhandley
    Member

    @adamsitnik Another scenario worth re-testing with #802

  6. ghost added
    in-pr
    on Aug 2, 2022
  7. self-assigned this
    on Aug 2, 2022
  8. removed
    needs-further-triage
    on Aug 2, 2022
  9. ghost removed
    in-pr
    on Aug 10, 2022
  10. adamsitnik commented on Aug 10, 2022

    @adamsitnik
    Member

    Fixed by #72193

  11. daxian-dbw commented on Aug 10, 2022

    @daxian-dbw
    ContributorAuthor

    Quote from #73257 (comment):

    We want the tags to be preserved by ReadKey instead of being stripped off.

    Thanks for the confirmation! In such a case this issue has been fixed with #73257 and the missing [ chars should be back now.

  12. ghost locked as resolved and limited conversation to collaborators on Sep 9, 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