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

CRLF is printing ^M #245

Closed
juneb opened this issue Jun 15, 2015 · 6 comments
Closed

CRLF is printing ^M #245

juneb opened this issue Jun 15, 2015 · 6 comments

Comments

@juneb
Copy link

juneb commented Jun 15, 2015

untitled2
Windows standard line endings are CRLF. In our PowerShell host, we make sure each \n is converted to a \r\n to conform to the standard, but PSReadLine expects only \n. When we pass \r\n, it prints ^M.

PSReadLine should conform to the Windows standard. Is it possible to make this change?

@lzybkr
Copy link
Member

lzybkr commented Jun 16, 2015

How do I reproduce this issue?

@juneb
Copy link
Author

juneb commented Jun 22, 2015

Jason, this is the PowerShell Studio console, but it should repro on any host that interprets \n as \r\n, per the Windows standard.
To repro in PowerShell Studio:

  1. Download and install the 45-day trial: https://www.sapien.com/software/powershell_studio
  2. If not 5.0, import PSReadline.
  3. In PowerShell Studio, Ctrl+N (new file).
  4. In the new file, type (any command), e.g. Get-Process
  5. Select the command and click Run / Run Selection in Console (Ctrl+Shift+F8).

@lzybkr
Copy link
Member

lzybkr commented Jun 22, 2015

I think PSReadline is doing the correct thing here, and the PowerShell Studio host is incorrectly sending \r as a keystroke.

For comparison, conhost does not send that key when pasting via right click. Similarly, if you paste via Ctrl+v, PSReadline does the right thing here.

That said, it looks like PowerShell Studio is redirecting standard input. That causes lots of problems because there is no terminal emulation support, so many key binding don't work. When PSReadline sees redirected input, I think I'll be forced to deal with emulating what conhost does in terms of ignoring \r.

If I'm wrong about how PowerShell Studio is implemented, then I think PowerShell Studio needs to be changed because it would be acting more like conhost in that case.

@juneb
Copy link
Author

juneb commented Jun 23, 2015

Thanks for the quick reply, Jason. I'll pass on the info.

@juneb
Copy link
Author

juneb commented Jun 23, 2015

I just checked and we don't redirect anything. We use standard Microsoft APIs to attach a console to a Windows host (AttachConsole) and write to the console (WriteConsole). WriteConsole requires CRLF, so we use it. It seems to me that PSReadline should support this.

@lzybkr
Copy link
Member

lzybkr commented Nov 11, 2017

Closing in favor of #579 which covers all of the known issues with right-click paste.

@lzybkr lzybkr closed this as completed Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants