Skip to content

Error on PageUp/PageDown keys #700

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
pavelbraginskiy opened this issue Jun 4, 2018 · 12 comments
Closed

Error on PageUp/PageDown keys #700

pavelbraginskiy opened this issue Jun 4, 2018 · 12 comments
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@pavelbraginskiy
Copy link

Environment data

PS version: 6.1.0-preview.2
PSReadline version: 2.0.0-beta1
os: Linux localhost.localdomain 4.16.13-300.fc28.x86_64 #1 SMP Wed May 30 14:31:00 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
PS file version: 

This is Fedora 28, using the terminal Konsole.

Steps to reproduce or exception report

Just hit PageUp or PageDown

Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 1 Keys:
 PageUp

Exception:
System.PlatformNotSupportedException: Operation is not supported on this platform.
   at System.ConsolePal.SetWindowPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ScrollDisplayUp(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
-----------------------------------------------------------------------
@pavelbraginskiy
Copy link
Author

On an unrelated note, if there is anything bound to Control+C, that bind won't work, so I can't do CopyOrCancelLine.

@lzybkr
Copy link
Contributor

lzybkr commented Jun 4, 2018

On your unrelated note, that should be fixed in 2.0.0-beta2 - but you need to specify Ctrl+c instead of Ctrl+C (lower case c.)

@lzybkr
Copy link
Contributor

lzybkr commented Jun 5, 2018

I meant beta2 (the link was correct).

@MathiasMagnus
Copy link

I come from the Home/End buttons not working issue and it still doesn't work for me. I tried installing the latest Beta, but I'm not sure if it's gone right or not. I am using vanilla PS Core on both my local box and my remote Ubuntu.

Home/End is working fine locally, both in Windows and in WSL. They also work remotely if using bash, or pwsh without PSReadline. It only breaks when PSReadline is enabled through ssh. I am using the latest build of Win32-OpenSSH.

To be sure, how do you install the latest beta of PSReadline? I tried

Install-Module -Name PSReadLine -RequiredVersion 2.0.0-beta3 -AllowPrerelease -Scope CurrentUser

But if I check later

Get-Module PSReadLine -ListAvailable -all


    Directory: C:\Users\mnagy\Documents\PowerShell\Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     2.0.0      PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLine…
Script     0.0        PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineOption, Set-PSReadLineKeyHand…

    Directory: C:\kellekek\microsoft\powershell\6.2.0\Modules

ModuleType Version    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     2.0.0      PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLine…
Script     0.0        PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineOption, Set-PSReadLineKeyHand

How can I check what version is loaded when Powershell starts? And what are the 0.0 versions?

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Mar 22, 2019

I can also repro this in iTerm2 on macOS and on Ubuntu.

After it does crash, I can no longer use Ctrl+C until after I hit ENTER

I suppose the actual problem is with the ScrollDisplay* functions:

PageDown      ScrollDisplayDown Scroll the display down one screen
PageUp        ScrollDisplayUp   Scroll the display up one screen

@MathiasMagnus
Copy link

I may not have been clear. There is no version of ssh client-server (Win32-OpenSSH or native), PSReadline, PowerShell and local-remote OS in which this would work. It seems like a very deterministic issue when using PS through an SSH connection. It makes using PS very annoying.

@vosscodes
Copy link

I'm also seeing this on 7.0.0 preview 1 with PSReadLine 2.0.0-beta4

@65156
Copy link

65156 commented Jul 4, 2019

I can also repro this in iTerm2 on macOS and on Ubuntu.

After it does crash, I can no longer use Ctrl+C until after I hit ENTER

I suppose the actual problem is with the ScrollDisplay* functions:

PageDown      ScrollDisplayDown Scroll the display down one screen
PageUp        ScrollDisplayUp   Scroll the display up one screen

is there an interim bandaid to disable the pageup/pagedown key bindings ? I am also having this problem.

@TylerLeonhardt
Copy link
Member

@frasercarter You can add this to your $profile:

Remove-PSReadLineKeyHandler -Chord ([System.ConsoleKey]::PageUp)
Remove-PSReadLineKeyHandler -Chord ([System.ConsoleKey]::PageDown)

@lzybkr
Copy link
Contributor

lzybkr commented Jul 5, 2019

Or more succinctly:

Remove-PSReadLineKeyHandler -Chord PageUp
Remove-PSReadLineKeyHandler -Chord PageDown

@olyis
Copy link

olyis commented Jul 26, 2019

With this environment

PS version: 5.1.17763.592
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: 199
BufferHeight: 9001

I get a similar problem but not the same exception.

Exception:
System.IO.IOException: The parameter is incorrect.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Console.SetWindowPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ScrollDisplayDown(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Running the suggested Remove-PSReadLineKeyHandler commands appears to stop this from happening.

@daxian-dbw daxian-dbw added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Sep 11, 2019
@daxian-dbw
Copy link
Member

Close as a duplicate of #1016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

8 participants