Strange error if command is larger than screen #10021

Closed
opened 2026-01-31 02:10:19 +00:00 by claunia · 5 comments
Owner

Originally created by @NicoNekoru on GitHub (Aug 5, 2020).

If I am running something that ends up having a size greater than the window, the terminal will just kinda break. Probably already has been an issue reported since this has occurred for a while now for me but just noting my experiences.

Environment

Current WT I'm using is the Windows Terminal 1.1.2021.0 from the Windows Store in Windows 10 Pro Version 2004

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.19041.0 Microsoft Windows NT 10.0.19041.0

Steps to reproduce

To reproduce this error all you need to do is have an open double quote and hold enter until the >>s fill the whole screen. If ENTER doesn't work use SHIFT-ENTER
image
and when it fills the whole screen the bug will trigger
image

Behaviour

You can no longer continuously edit parts lower than the bottom >>
image
(I clicked 'f' then it immediately put my buffer at the bottom)
The error message

Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 57 Keys:
 c d . . Enter
 c d N e LeftArrow LeftArrow Space RightArrow DownArrow RightArrow k o Enter
 " Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 Enter
 UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow f

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 -2.
   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.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(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)
-----------------------------------------------------------------------

image

Or something similar will appear even though it doesn't in normal PowerShell
image
image

Originally created by @NicoNekoru on GitHub (Aug 5, 2020). If I am running something that ends up having a size greater than the window, the terminal will just kinda break. Probably already has been an issue reported since this has occurred for a while now for me but just noting my experiences. # Environment Current WT I'm using is the Windows Terminal 1.1.2021.0 from the Windows Store in Windows 10 Pro Version 2004 ```none Platform ServicePack Version VersionString -------- ----------- ------- ------------- Win32NT 10.0.19041.0 Microsoft Windows NT 10.0.19041.0 ``` # Steps to reproduce To reproduce this error all you need to do is have an open double quote and hold enter until the `>>`s fill the whole screen. If <kbd>ENTER</kbd> doesn't work use <kbd>SHIFT-ENTER</kbd> ![image](https://user-images.githubusercontent.com/66227158/89453906-256ac880-d71d-11ea-85ca-bf4bf682c37c.png) and when it fills the whole screen the bug will trigger ![image](https://user-images.githubusercontent.com/66227158/89453960-3adff280-d71d-11ea-9ce5-c75a45226fbb.png) # Behaviour You can no longer continuously edit parts lower than the bottom `>>` ![image](https://user-images.githubusercontent.com/66227158/89454071-6367ec80-d71d-11ea-8bf9-daee40fd611a.png) (I clicked 'f' then it immediately put my buffer at the bottom) The error message ``` Oops, something went wrong. Please report this bug with the details below. Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new ----------------------------------------------------------------------- Last 57 Keys: c d . . Enter c d N e LeftArrow LeftArrow Space RightArrow DownArrow RightArrow k o Enter " Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter Enter UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow f 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 -2. 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.Insert(Char c) at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(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) ----------------------------------------------------------------------- ``` ![image](https://user-images.githubusercontent.com/66227158/89454169-8eead700-d71d-11ea-8d9a-774dd7529608.png) Or something similar will appear even though it doesn't in normal PowerShell ![image](https://user-images.githubusercontent.com/66227158/89454276-b5a90d80-d71d-11ea-9ed6-14a2d07c3915.png) ![image](https://user-images.githubusercontent.com/66227158/89454309-be014880-d71d-11ea-8eca-7228bde9498a.png)
claunia added the Needs-TriageResolution-ExternalNeeds-Tag-FixNeeds-Attention labels 2026-01-31 02:10:20 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Aug 5, 2020):

That error message pretty specifically tells you that you should file an issue on the PSReadline repo

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

This is due to the fact that the Terminal uses a buffer size that's fixed to the size of the window, something that's totally a valid state in the vintage console, and something that PSReadline should be redundant enough to handle on it's own.

@zadjii-msft commented on GitHub (Aug 5, 2020): That error message pretty specifically tells you that you should file an issue on [the PSReadline repo](https://github.com/Powershell/PSReadLine/issues/new) > Oops, something went wrong. Please report this bug with the details below. > Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new This is due to the fact that the Terminal uses a buffer size that's fixed to the size of the window, something that's totally a valid state in the vintage console, and something that PSReadline should be redundant enough to handle on it's own.
Author
Owner

@NicoNekoru commented on GitHub (Aug 5, 2020):

This is due to the fact that the Terminal uses a buffer size that's fixed to the size of the window, something that's totally a valid state in the vintage console, and something that PSReadline should be redundant enough to handle on it's own.

@zadjii-msft Sounds like it was intended I guess, does WT's buffer rely on PSReadLine?

@NicoNekoru commented on GitHub (Aug 5, 2020): > This is due to the fact that the Terminal uses a buffer size that's fixed to the size of the window, something that's totally a valid state in the vintage console, and something that PSReadline should be redundant enough to handle on it's own. @zadjii-msft Sounds like it was intended I guess, does WT's buffer rely on PSReadLine?
Author
Owner

@DHowett commented on GitHub (Aug 5, 2020):

@NicoNekoru It's more like... WT and the Windows Console have a buffer, which has certain properties. PSReadline, which is part of powershell (and is only used in powershell) tries to interact with that buffer in a certain way. It is not properly guarded against one common buffer configuration. 😄

@DHowett commented on GitHub (Aug 5, 2020): @NicoNekoru It's more like... WT and the Windows Console _have_ a buffer, which has certain properties. PSReadline, which is part of powershell (and is only used in powershell) tries to interact with that buffer in a certain way. It is not properly guarded against one common buffer configuration. :smile:
Author
Owner

@NicoNekoru commented on GitHub (Aug 5, 2020):

@DHowett So WT uses the buffer in an unusual configuration? This doesn't occur in PS Desktop or PS Core apps from what I have tested

@NicoNekoru commented on GitHub (Aug 5, 2020): @DHowett So WT uses the buffer in an unusual configuration? This doesn't occur in PS Desktop or PS Core apps from what I have tested
Author
Owner

@zadjii-msft commented on GitHub (Aug 5, 2020):

It's not really an "unusual" configuration so much as it is an "uncommon" one. It's a perfectly valid scenario, just one that most users of the vintage console don't use (because they usually want a scrollback).

You can see this bug repro in the vintage console if you set "Window Size" and "Buffer Size" to the same dimensions.

@zadjii-msft commented on GitHub (Aug 5, 2020): It's not really an "unusual" configuration so much as it is an "uncommon" one. It's a perfectly valid scenario, just one that most users of the vintage console _don't_ use (because they usually want a scrollback). You can see this bug repro in the vintage console if you set "Window Size" and "Buffer Size" to the same dimensions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10021