-
Notifications
You must be signed in to change notification settings - Fork 316
Closed
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues, especially the pinned issues.
Exception report
Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new
### Environment
PSReadLine: 2.0.0
PowerShell: 5.1.22621.4391
OS: Microsoft Windows 10.0.22631
Last 88 Keys
UpArrow UpArrow Enter
UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow DownArrow Ctrl+c I n s t a l l - P a c k a g e P r o v i d e r Spacebar - N a m e Spacebar N u G e t Spacebar - M i n i m u m V e r s i o n Spacebar 2 . 8 . 5 . 2 0 1 Spacebar - F o r c e Enter
RightArrow RightArrow 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 42.
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(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)
Screenshot

Environment data
PS Version: 5.1.22621.4391
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0
PSReadLine EditMode: Windows
OS: 10.0.22621.1 (WinBuild.160101.0800)
BufferWidth: 156
BufferHeight: 43
Steps to reproduce
Open a PowerShell 5.1 session with PSReadLine 2.0.0 on Windows.
Repeatedly use UpArrow to navigate command history.
Interrupt with Ctrl+C and rerun Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force.
Use a mix of arrow keys (RightArrow, UpArrow, etc.).
PSReadLine throws exception after multiple key inputs, possibly when command line height exceeds buffer size.
Expected behavior
Command history navigation and command input should not crash the session, regardless of buffer position.
Actual behavior
PSReadLine crashes with System.ArgumentOutOfRangeException, specifically due to the top position being out of bounds relative to the buffer height.
Metadata
Metadata
Assignees
Labels
No labels