PowerShell / PSReadLine

A bash inspired readline implementation for PowerShell
BSD 2-Clause "Simplified" License
3.7k stars 294 forks source link

Exception - seemingly caused by github copilot suggestion issue (italics text in screenshot) #4073

Open oliver-sey opened 2 months ago

oliver-sey commented 2 months ago

Prerequisites

Exception report

Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

### Environment
PSReadLine: 2.4.0-beta0+923a890f2e7ea10465f3a80a2bc030121a1c2f68
PowerShell: 2024.2.2
OS: Microsoft Windows 10.0.22631
BufferWidth: 124
BufferHeight: 10

Last 200 Keys:

 Backspace Backspace Backspace i n i Tab Enter
 p r o v Tab Enter
 UpArrow Spacebar - S E R V I C E _ N A M E Spacebar " t e s t c s h a r p " Enter
 Ctrl+c k u b e c t l Spacebar l o g s Spacebar t e s t c s h a r p - s t a t e f u l s e t - 9 0 Backspace Backspace 0 Enter
 h Backspace Backspace g i t Spacebar Tab Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace RightArrow Enter
 p r o Backspace Backspace Backspace Backspace k u b e c t l Spacebar g e t Spacebar a l l Enter
 p r o v Tab RightArrow Ctrl+LeftArrow Ctrl+RightArrow LeftArrow 3 Enter
 k u b e c t l Spacebar l o g s Spacebar t e s t c s h a r p 3 - 0 Enter
 UpArrow Enter
 k u b e c t l Spacebar d e s c Ctrl+c

### 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 10.
   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.CancelLine(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.CopyOrCancelLine(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, Nullable`1 lastRunStatus)

Screenshot

image

Environment data

PS Version: 5.1.22621.3880
PS HostName: Visual Studio Code Host
PSReadLine Version: 2.4.0-beta0
PSReadLine EditMode: Windows
OS: 10.0.22621.1 (WinBuild.160101.0800)
BufferWidth: 124
BufferHeight: 32

Steps to reproduce

type something, wait for copilot suggestion to pop up, ctrl c

Expected behavior

a new clean prompt for you to enter a command

Actual behavior

The exception that is described above happens. I also often get an issue, especially after resizing the terminal, where the text I am typing overwrites the 'PS :', or commands that I previously ran. Or when I start typing a command it is weirdly a bunch of lines down the screen from the last command I ran, and weirdly to the right side. This happens a lot when I am opening and closing the left side menu in vscode. It's possible those similar causes are a cause here

daxian-dbw commented 1 month ago

I cannot reproduce the issue Did you resize the terminal window before you pressed Ctrl+c?

oliver-sey commented 1 month ago

Hello, Yes I did resize the window. I constantly got strange issues with the terminal in VSCode after resizing the terminal bar in there. For example, one line of output would be repeated many times and overwrite other lines after resizing. Not sure if this is your issue or VScode.

Thanks, Oliver


From: Dongbo Wang @.> Sent: Monday, August 5, 2024 10:53:02 AM To: PowerShell/PSReadLine @.> Cc: Oliver Seymour @.>; Author @.> Subject: Re: [PowerShell/PSReadLine] Exception - seemingly caused by github copilot suggestion issue (italics text in screenshot) (Issue #4073)

I cannot reproduce the issue Did you resize the terminal window before you pressed Ctrl+c?

— Reply to this email directly, view it on GitHubhttps://github.com/PowerShell/PSReadLine/issues/4073#issuecomment-2269600006, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUEFD5CUPNRCKWX5SFNFN7DZP63X5AVCNFSM6AAAAABKZURGX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRZGYYDAMBQGY. You are receiving this because you authored the thread.Message ID: @.***>

daxian-dbw commented 1 month ago

For example, one line of output would be repeated many times and overwrite other lines after resizing.

Could you please give a detailed repro for this issue instead? Resizing the window could cause issue to PSReadLine.