Skip to content

CRLF is printing ^M #245

Closed
Closed

Description

@juneb

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?

Activity

  1. lzybkr commented on Jun 16, 2015

    @lzybkr
    Contributor

    How do I reproduce this issue?

  2. juneb commented on Jun 22, 2015

    @juneb
    Author

    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).
  3. lzybkr commented on Jun 22, 2015

    @lzybkr
    Contributor

    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.

  4. juneb commented on Jun 23, 2015

    @juneb
    Author

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

  5. juneb commented on Jun 23, 2015

    @juneb
    Author

    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.

  6. lzybkr commented on Nov 11, 2017

    @lzybkr
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions