Skip to content

Exception when attempting to clear terminal screen using Ctrl+L #4945

@frdemareschal

Description

@frdemareschal

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

-----------------------------------------------------------------------
Last 200 Keys:
 p Space s h o w Space j i n j a Enter
 UpArrow 2 Enter
 UpArrow Backspace Backspace Backspace Backspace Backspace Backspace d a Backspace j a n h o Backspace Backspace g o Enter
 r i Space - R e c u r s e Space - F o r c e Space b Tab Enter
 c m a k Space Backspace e Space - S Space . Space - B Space b u i l d Space - G Space N i n j a Enter
 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 DownArrow Enter
 Ctrl+l UpArrow UpArrow UpArrow UpArrow UpArrow DownArrow UpArrow UpArrow UpArrow UpArrow Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace d o Tab Enter
 UpArrow Space - - h e l p Enter
 UpArrow Enter
 UpArrow Enter
 UpArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+RightArrow LeftArrow LeftArrow g e n Space Enter
 UpArrow UpArrow Enter
 UpArrow UpArrow Enter
 UpArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow RightArrow RightArrow e r a t e Enter
 UpArrow Enter
 Ctrl+l

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 -16.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   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)
-----------------------------------------------------------------------

Screenshot

Image

Environment data

PS Version: 5.1.19041.6328
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 209
BufferHeight: 52

Steps to reproduce

  • Entered Python 3.12 venv earlier using .\.venv\Scripts\Activate.ps1
  • Move the terminal from the main screen (external, 1920x1080, 22") to the secondary (laptop, 1920x1020, 15,6")
  • Perform Ctrl+L from bash muscle memory 😆
  • Exception

Expected behavior

The screen terminal clears and the prompt is displayed at the top left of it.

Actual behavior

The above exception happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions