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

Smart quotes get removed when pasting to PS7 #1603

Closed
SteveL-MSFT opened this issue Jun 14, 2020 · 5 comments
Closed

Smart quotes get removed when pasting to PS7 #1603

SteveL-MSFT opened this issue Jun 14, 2020 · 5 comments

Comments

@SteveL-MSFT
Copy link
Member

Environment

PS version: 7.1.0-preview.3
PSReadline version: 2.1.0-beta2
os: 10.0.19041.1 (WinBuild.160101.0800)
PS file version: 7.1.0.0
HostName: ConsoleHost (Windows Terminal)
BufferWidth: 179
BufferHeight: 53

Steps to reproduce

Copy the script from: https://devblogs.microsoft.com/powershell/mandelbrot-one-liner/

Paste into Windows PowerShell
Paste into PowerShell 7 (doesn't matter if conhost or Windows Terminal)

Does't matter if CTRL-V or right click to paste

Expected behavior

Script runs like in Windows PowerShell

Actual behavior

ParserError:
Line |
   1 |  … ile(($y++) -lt 15) {for($x=0; ($x++) -lt 84; write-host ( .:-;!/>`)|& …
     |                                                                 ~
     | Missing closing ')' in expression.

The "smart quotes" around the string of printable characters get removed. Removing PSReadLine enables paste to work correctly. Paste with PSReadLine works fine on macOS.

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Jun 14, 2020
@SteveL-MSFT SteveL-MSFT added this to the 2.1.0-Consider milestone Jun 14, 2020
@vexx32
Copy link

vexx32 commented Jun 14, 2020

This was reported a couple years back already, I think. #760 is the same issue; seems like it affects quotes and dashes as well.

@lzybkr
Copy link
Member

lzybkr commented Jun 15, 2020

This doesn't reproduce in conhost or Windows Terminal if the output encoding is UTF8:

[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

@daxian-dbw
Copy link
Member

Does't matter if CTRL-V or right click to paste

When PSReadLine is imported, the issue only reproduce for me when pasting using Right Click, not when using ctrl+v.
@SteveL-MSFT are you able to reproduce using ctrl+v?

Right Click removes the smart quotes even after setting the console output encoding to UTF8. But once unload PSReadLine, Rigth Click works fine in both conhost and WIndows Terminal, even if the output encoding is not UTF8 (default output encoding is ibm437).

@daxian-dbw
Copy link
Member

Further investigation shows this is likely caused by the call to Console.KeyAvailable. It somehow causes the next Unicode character input to be skipped. I opened dotnet/runtime#38966 and will mark this issue external.

@wswind
Copy link

wswind commented Feb 3, 2021

It has been such a long time . I'm still waiting for this issue to be fixed #1771 (comment)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants