Skip to content

Long here-strings scroll on every keypress #962

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

Closed
AikenBM opened this issue Jul 11, 2019 · 4 comments
Closed

Long here-strings scroll on every keypress #962

AikenBM opened this issue Jul 11, 2019 · 4 comments

Comments

@AikenBM
Copy link

AikenBM commented Jul 11, 2019

After updating to PowerShell Core 6.2.1, I've noticed an issue with how PSReadLine handles multiline entry in both Windows PowerShell 5.1 and PowerShell Core 6. When entering a long multi-line entry in a here-string, PSReadLine scrolls to the first line of the prompt and then scrolls to the end on each keypress. On very long entries, this can take extremely long to scroll between each keypress.

Environment data

PS version: 6.2.1
PSReadline version: 2.0.0-beta3
os: 10.0.17763.1 (WinBuild.160101.0800)
PS file version: 6.2.1.0
BufferWidth: 200
BufferHeight: 9001
PS version: 5.1.17763.503
PSReadline version: 2.0.0-beta2
os: 10.0.17763.1 (WinBuild.160101.0800)
PS file version: 10.0.17763.1 (WinBuild.160101.0800)
BufferWidth: 200
BufferHeight: 3000

I'm unsure how to update either of these; I don't see that beta4 has a binary release. I'm not able to install Powershell Core 7 preview, unfortunately, so I cannot test that. Major version increments have to be approved even for testing on my systems.

Steps to reproduce or exception report

First, create a long multiline string.

On PowerShell 5:

# Set a long multiline string
1..1000 | Set-Clipboard

On PowerShell Core 6 with the ClipboardText module:

# Set a long multiline string
1..1000 | Set-ClipboardText

In reality, this list of values or long string would come from outside of Powershell entirely; this is just a convenient analog.

Now, start writing a command with a here-string command and paste the text from your clipboard. Powershell will scroll to the end of the entry.

PS C:\> $x = -split @'
>> 1
>> 2
>> 3
...
>> 998
>> 999
>> 1000

That's all fine.

Now, try closing the here-string and piping it to a command:

>> 998
>> 999
>> 1000
>> '@ | Get-Random -Count 25

Every time you press a key, Powershell will jump back up 1000 lines and scroll the output back down. If you start typing normally, you can't even read the screen because it's scrolling so wildly. Arrow keys work normally, but selecting text with arrow keys causes the scrolling issue again.

The only workaround I've found is to disable PSReadLine with Remove-Module PSReadline. I don't remember this happenning with PSReadLine 1.2.

@daxian-dbw daxian-dbw added this to the 2.0.0-Consider milestone Jul 16, 2019
@AikenBM
Copy link
Author

AikenBM commented Aug 14, 2019

To clarify, this scrolling issue happens on any long multi-line entry, it's just easiest to reproduce with a long here-string. A long list of values separated by a comma and a line break, or a really long ForEach-Object script block would experience the same scrolling problem.

@vexx32
Copy link

vexx32 commented Aug 14, 2019

From @daxian-dbw's examples in #979, it looks like this should be sorted out in the scope of that PR?

@daxian-dbw
Copy link
Member

#979 should mitigate the issue in cases that editing happens at relatively the end part of the long text.

@daxian-dbw
Copy link
Member

The specific behavior reported by this issue was fixed by #979

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

3 participants