Skip to content

Exception when used in Cursor (some times) #4759

@Frulfump

Description

@Frulfump

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

System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than t
he console's buffer size in that dimension. (Parameter 'top')
Actual value was 4.
   at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.SetCursorPosition(Int32 left, Int32 top)       
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColo
r)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Render()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTabl
e, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineInt
rinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Last 200 Keys:

r u e ) ; Spacebar r e a d e r Spacebar = Spacebar e a s y o c r . R e a d e r ( [ ' e n ' ] , Spa
cebar g p u = F a l s e ) ; Spacebar p r i n t ( ' R e a d e r Spacebar i n i t i a l i z e d : ' ,
Spacebar r e a d e r Spacebar i s Spacebar n o t Spacebar N o n e ) " Enter
u v Spacebar r u n Spacebar p y t e s t Spacebar t e s t s / i n t e g r a t i o n / t e s t _ m e
n u _ n a v i g a t i o n _ i n t e g r a t i o n . p y : : T e s t M e n u N a v i g a t i o n I
n t e g r a t i o n : :

Screenshot

N/A

Environment data

PSReadLine: 2.3.6+d2e770f93b7a53d8660a6402eb29d1ae1c35e767
PowerShell: 7.5.1
OS: Microsoft Windows 10.0.19045
BufferWidth: 99
BufferHeight: 1

Steps to reproduce

It happens some times (sorry, but atleast some safe guard around the exception could be added even without proper repro steps I hope).

I have added Set-PSReadLineOption -PredictionSource None before I start my session but this doesn't seem to help as I get the exception above. And I tried to remove PSReadLine with Remove-Module PSReadLine -ErrorAction SilentlyContinue but it seems to load the default version of PSReadLine shiped with pwsh then.

Expected behavior

No Exception...

Actual behavior

The above exception happens...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-Triage 🔍It's a new issue that core contributor team needs to triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions