Certain (possibly just full-screen overlayed) commands or operations cause PSReadLine to stop working afterwards, and in some cases, for the console (process) to become completely unresponsive.
I have a reliable reproduction below, although it only reproduces one aspect of the problem I've surfaced (I don't have a reliable repro for the console becoming unresponsive).
pwsh-preview -NoProfile
help Get-Alias
(press 'q' to quit)
(press Up-Arrow / Down-Arrow to cycle through history)
History is cycled
History is not cycled / input sometimes unresponsive
Name Value
---- -----
PSVersion 7.0.0-preview.2
PSEdition Core
GitCommitId 7.0.0-preview.2
OS Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Strangely, I noticed that Get-Help Get-Alias
works differently than help Get-Alias
help Get-Alias
opens a multiple-line scrollable view of the help text, whereas Get-Help Get-Alias
just dumps it out all at once on screen
So whatever the behavior is that does the fullscreen scrollable view (help Get-Alias
) is what seems to break PSReadLine
I confirmed that help Get-Alias
seems to open the help text for Get-Alias
using linux less
(confirmed since I can press h
and see less
help commands)
So something about how it's opening less
is breaking PSReadLine ?
I also discovered that running a sub-instance of pwsh-preview
from the 'broken' state, and then exiting that shell, fixes the issue.
e.g. after reproducing the above, then:
pwsh-preview
exit
allows the original pwsh-preview
session to page up/down through history again
Confirmed that I can repro just by doing
echo "foo" | less
or
echo "foo" | more
from inside a pwsh-preview
prompt
after exiting less
or more
as per above, none of the arrow keys work for moving the cursor, and I can't use shortcuts like alt+arrow to move the cursor across words, etc.
I can repro this easily. Doing a cls
to clear the screen seems to make it work again.
So what appears to be happening is that after you exit less
, the up arrow is received as the VT100 escape sequence {ESC}A
which PSReadLine doesn't treat as the up arrow (this is true for all for arrow keys, you can't go left for example). Clearing the screen seems to reset the terminal so the arrow keys are received as just arrow keys. Seems like this might be an issue in corefx.
This looks like a regression in .NET Core 3.0. Using 6.2.1 w/ same PSReadLine doesn't repro. I'll have to see about getting them a simpler repro.
I had similar issues after invoking any command with completion which triggered scrolling,
Just checked that the .NET Core fix is not included in .NET Core Preview 9.
Well, that's a bummer. :-(
@SteveL-MSFT: Before @rkeithhill pointed me here, I had created virtual duplicate https://github.com/PowerShell/PowerShell/issues/10524.
Given that the issue is not PSReadLine-related (it happens as well if you explicitly unload the latter first), should we track the issue there?
It was originally reported in https://github.com/PowerShell/PowerShell and was moved here.
I see, @eedwards-sk - it's understandable that PSReadLine
would be the initial suspect, but it isn't the perp (if you will) here.
That said, given that the two issues are now linked and can be found in either repo, I guess no further action is needed.
The fix was included in .NET Core RC1 and available with 7.0.0-preview.4
@daxian-dbw this isn't fixed -- please re-open
it's still occurring on 7.0.0-preview.4
The issue doesn't reproduce on Linux anymore, but still reproduce on macOS.
@daxian-dbw: Curiously, I don't see it on my macOS 10.14.6 system with preview 4.
Weird. I can repro it on macOS 10.14.6 system with preview 4 ...
Same -- I'm on OSX 10.14.6 and still reproing it.
OK, I just built PowerShell against .NET Core 3.0 RTM on my macOS and the issue is gone with the .NET Core 3.0 RTM.
I will leave this issue open until we release 7.0.0-preview.5, which will use .NET Core 3.0 RTM build.
Doesn't repro for me on macOS PS7 P5.
Most helpful comment
This looks like a regression in .NET Core 3.0. Using 6.2.1 w/ same PSReadLine doesn't repro. I'll have to see about getting them a simpler repro.