Skip to content
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

Exception when recalling command line with more lines than screen #677

Closed
MaximoTrinidad opened this issue Apr 23, 2018 · 8 comments
Closed
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@MaximoTrinidad
Copy link

MaximoTrinidad commented Apr 23, 2018

PSReadLine crashes when doing Up arrow looking for commands that has been previously executed.

Environment data

Provide the output of the following:

& {
    "PS version: $($PSVersionTable.PSVersion)"
    $v = (Get-Module PSReadline).Version
    $m = Get-Content "$(Split-Path -Parent (Get-Module PSReadLine).Path)\PSReadLine.psd1" | Select-String "Prerelease = '(.*)'"
    if ($m) {
        $v = "$v-" + $m.Matches[0].Groups[1].Value
    }
    "PSReadline version: $v"
    if ($IsLinux -or $IsMacOS) {
        "os: $(uname -a)"
    } else {
        "os: $((dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion)"
    }
    "PS file version: $((dir $pshome\p*[hl].exe).VersionInfo.FileVersion)"
}

PS version: 6.1.0-preview.1
PSReadline version: 1.2
os: Linux mars 4.13.0-38-generic #43-Ubuntu SMP Wed Mar 14 15:20:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
PS file version: 

-->

Steps to reproduce or exception report

Use the keyboard up arrow to scan thru previous entered commands.
Exception message:

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

Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -25.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.TTYConsole.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.PlaceCursor(Int32 x, Int32& y)
   at Microsoft.PowerShell.PSConsoleReadLine.PlaceCursor()
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Render()
   at Microsoft.PowerShell.PSConsoleReadLine.UpdateFromHistory(Boolean moveCursor)
   at Microsoft.PowerShell.PSConsoleReadLine.HistoryRecall(Int32 direction)
   at Microsoft.PowerShell.PSConsoleReadLine.PreviousHistory(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)
-----------------------------------------------------------------------

psreadline_error_2018-04-23_15-40-01

@MaximoTrinidad
Copy link
Author

FYI

Windows and macOS seems OK!

@lzybkr
Copy link
Member

lzybkr commented Apr 23, 2018

If this is reproducible - can you try with 2.0.0-beta1? I think it's fixed in that build.

@MaximoTrinidad
Copy link
Author

@lzybkr ,

I will try it and let you know if it works.
:)

@MaximoTrinidad
Copy link
Author

MaximoTrinidad commented Apr 23, 2018

@lzybkr,

Same error with PSReadLine 2.0.0-beta1 doing the same repo steps.
:(

psreadline_error_beta_2018-04-23_15-40-01

Info

PS /home/maxt> & {
>>     "PS version: $($PSVersionTable.PSVersion)"
>>     $v = (Get-Module PSReadline).Version
>>     $m = Get-Content "$(Split-Path -Parent (Get-Module PSReadLine).Path)\PSReadLine.psd1" | Select-String "Prerelease = '(.*)'"
>>     if ($m) {
>>         $v = "$v-" + $m.Matches[0].Groups[1].Value
>>     }
>>     "PSReadline version: $v"
>>     if ($IsLinux -or $IsMacOS) {
>>         "os: $(uname -a)"
>>     } else {
>>         "os: $((dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion)"
>>     }
>>     "PS file version: $((dir $pshome\p*[hl].exe).VersionInfo.FileVersion)"
>> }
PS version: 6.1.0-preview.1
PSReadline version: 2.0.0-beta1
os: Linux mars 4.13.0-38-generic #43-Ubuntu SMP Wed Mar 14 15:20:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
PS file version: 

@lzybkr
Copy link
Member

lzybkr commented Apr 23, 2018

Does the command line that it crashes on have more lines than are visible on the screen?

@MaximoTrinidad
Copy link
Author

@lzybkr ,

Sorry! Yes!!
See below.

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

Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -6.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.HistoryRecall(Int32 direction)
   at Microsoft.PowerShell.PSConsoleReadLine.PreviousHistory(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)
-----------------------------------------------------------------------
PS /home/maxt> exit                                                                                                                 

psreadline_error_beta_02_2018-04-23_15-40-01

@lzybkr lzybkr changed the title PSReadLine in Linux crashes when doing Up arrow looking for commands Exception when recalling command line with more lines than screen Apr 23, 2018
@bgshacklett
Copy link

Is this potentially related to #663?

@lzybkr
Copy link
Member

lzybkr commented Apr 24, 2018

Yep, I recalled the other but didn't look for it. Thanks @bgshacklett.

@lzybkr lzybkr closed this as completed Apr 24, 2018
@lzybkr lzybkr added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Apr 24, 2018
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

3 participants