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

Multi-line paste fails to render properly in Terminal Preview, when copied from gist.github.com #7296

Closed
pcgeek86 opened this issue Aug 14, 2020 · 7 comments
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@pcgeek86
Copy link

Environment

[cbt] C:\Users\TrevorSullivan\git> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Windows Terminal 1.2.2234.0

Steps to reproduce

  1. Using Google Chrome, go to https://gist.github.com
  2. Create a new gist (but don't save it), using the example below
  3. Copy the text from the gist and paste it into the Microsoft Windows Terminal Preview
$Person = @{
  FirstName = 'Trevor'
  LastName = 'Sullivan'
  Likes = @(
    'Bacon',
    'Beer',
    'Software'
  )
}

This example fails as well:

@(
1
2
3
)

I can't be 100% sure, but it seems like maybe some "hidden" formatting from gist.github.com is causing this behavior? When I copied and pasted the examples using the GitHub issue editor (as I am authoring this), I can't reproduce it from here. 🤷🏻‍♂️

Expected behavior

The copied (unformatted) text is pasted precisely, character-for-character. The cursor position is at the end of the paste, so I can simply press ENTER to run the pasted command.

Actual behavior

The text is being pasted incorrectly. It appears that the first and last line of the paste are actually being reversed.

image

Also if I hit ENTER to run the command, it gets mangled even further. I'm not sure if the cursor position is actually where it visually appears to be.

image

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Aug 14, 2020
@DHowett
Copy link
Member

DHowett commented Aug 15, 2020

Thanks for the report! I think this is another instance of the problem in #5821, but I can't be sure. We end up sending the CR before the LF, and powershell reacts by moving to the beginning of the line:

1
2
3

becomes

|1

where the cursor is |

and then it inserts LF. PowerShell doesn't submit the command because pressing enter anywhere but the end of the line actually allows a line break. Then it sends 2

2|
1

CR

|2
1

and so on.

Working on our pasting story is gonna help this out, so I'm going to roll this together with /dup #5821.

@ghost
Copy link

ghost commented Aug 15, 2020

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Aug 15, 2020
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Aug 15, 2020
@DHowett
Copy link
Member

DHowett commented Aug 15, 2020

(Also, that's a lovely color scheme. What is it?)

@DHowett
Copy link
Member

DHowett commented Aug 15, 2020

Alright, confirmed:

image

those are LFs!

@pcgeek86
Copy link
Author

@DHowett it's just the built-in One Half Dark color scheme. 😀 I created a PowerShell module that makes it easy to switch between color schemes, and in the future other settings.

https://github.com/pcgeek86/terminal

@pcgeek86
Copy link
Author

Here's the video that shows the module in action (off-topic from OP)

https://youtu.be/0aMXBMSBE4Y

@DHowett
Copy link
Member

DHowett commented Aug 15, 2020

Lovely! Thanks :D

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

2 participants