You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cut multiline output inserts linebreak on paste #517
Linebreaks appear to be inserted into screen output at width of buffer. Below, the console width is where the first line is cut off in the actual section.
# make sure console width is less than the width of this line
PS C:\Users\slee\repos\PowerShell>Write-Host"this is a long sentence that shouldn't have any linebreaks"
this is a long sentence that shouldn't have any linebreaks# cut and paste the sentence above
Expected
PS C:\Users\slee\repos\PowerShell>"this is a long sentence that shouldn't have any linebreaks"
Actual
PS C:\Users\slee\repos\PowerShell>"this is a long se>> ntence that shouldn't have any linebreaks"
In the current renderer, fixing this is impossible - I'm using apis below where conhost can infer anything about where line breaks are, this is done for performance, but is not portable.
In the new renderer, I'm writing out a single string using an api like Console.WriteLine - the string has escape sequences in it for coloring. This means conhost can infer the line breaks correctly.
OK! So, we are with PowerShell Core v6.0.0-beta.7. We can't rely on the editor to do the magic when in fact the Module PSReadline is still having issues.
There are third-party editors, like SAPIEN Technologies PrimalScript, out there that can add the PowerShell Core console and use it to run the PowerShell Core Scripts.
So, here are some behavior I found:
VS Code works fine using both the PowerShell Integrated Console and the RunCode extension.
Copy/Paste from Any Editor straight to the PSCore console breaks (in both Windows and Linux) only if: (see below)
:
}
else
}
:
Now, in PrimalScript editor, PSReadLine module seems to work in Windows but not when connected to Linux PowerShell Core console. Only works if I remove the PSReadline module in both Windows and Linux.
I think this is an issue that need some attention!
That said, pasting with Ctrl+v avoids this issue. Today that only works in Windows PowerShell, but I have changes in the ansi_render branch to support Ctrl+v in PowerShell Core on Windows. I don't know how to implement that functionality on Linux/Mac.
There may be some other heuristics we could use, e.g. detecting paste, assuming humans don't type as fast as pasting, but that has been a low priority item because Ctrl+v is a better experience anyway (much, much faster!)
The alternative before PSReadline was to always require an empty line and I'm not a fan of that approach.
Sure, it's not release quality yet. A couple of examples - my attempt to fix CJK broke use of screen in a big way and posh-git in a small way. I know of one issue where PowerShell crashes, and there are some minor artifacts during rendering.
I think there are more good things coming soon, I just received a PR to handle redirected input, a common problem.
Activity
lzybkr commentedon Mar 11, 2017
I have work in progress that should fix this.
In the current renderer, fixing this is impossible - I'm using apis below where
conhostcan infer anything about where line breaks are, this is done for performance, but is not portable.In the new renderer, I'm writing out a single string using an api like
Console.WriteLine- the string has escape sequences in it for coloring. This meansconhostcan infer the line breaks correctly.MaximoTrinidad commentedon Oct 1, 2017
OK! So, we are with PowerShell Core v6.0.0-beta.7. We can't rely on the editor to do the magic when in fact the Module PSReadline is still having issues.
There are third-party editors, like SAPIEN Technologies PrimalScript, out there that can add the PowerShell Core console and use it to run the PowerShell Core Scripts.
So, here are some behavior I found:
I think this is an issue that need some attention!
Is there still a plan to correct it?
:)
lzybkr commentedon Oct 3, 2017
Maximo Trinidad (@MaximoTrinidad) - your comment unrelated to this issue - you open a new one if you want.
That said, pasting with Ctrl+v avoids this issue. Today that only works in Windows PowerShell, but I have changes in the
ansi_renderbranch to support Ctrl+v in PowerShell Core on Windows. I don't know how to implement that functionality on Linux/Mac.There may be some other heuristics we could use, e.g. detecting paste, assuming humans don't type as fast as pasting, but that has been a low priority item because Ctrl+v is a better experience anyway (much, much faster!)
The alternative before PSReadline was to always require an empty line and I'm not a fan of that approach.
lzybkr commentedon Oct 16, 2017
I believe this is fixed in #561.
I'll publish a pre-release version to the PowerShell Gallery as soon as they support pre-releases.
If you'd like to try a fix before that, you can build the lastest yourself from the master branch, or
grab a build from AppVeyor like this one.
Note the version number is now 2.0, so be sure to copy the contents to \PSReadLine\2.0.
vors commentedon Oct 23, 2017
Verified, this is fixed
vors commentedon Oct 23, 2017
Jason Shirk (@lzybkr) any reason to do a pre-release instead of a normal one?
lzybkr commentedon Oct 23, 2017
Sure, it's not release quality yet. A couple of examples - my attempt to fix CJK broke use of
screenin a big way andposh-gitin a small way. I know of one issue where PowerShell crashes, and there are some minor artifacts during rendering.I think there are more good things coming soon, I just received a PR to handle redirected input, a common problem.
lzybkr commentedon Nov 4, 2017
I'll have an official prerelease build out next week if you want to verify this is fixed, otherwise you can grab a build out of appveyor here.