PSReadLine error on code paste #19939

Closed
opened 2026-01-31 06:58:06 +00:00 by claunia · 2 comments
Owner

Originally created by @wizardtoast on GitHub (May 24, 2023).

Windows Terminal version

1.16.10261.0

Windows build number

10.0.19045.0

Other Software

No response

Steps to reproduce

  1. Copy code snippet with multiple lines of code (code used)
  2. Ensure window height is small enough to require scrolling after pasting code
  3. Paste code snippet into terminal

Expected Behavior

Code is pasted without error and terminal ready for next input

Actual Behavior

Code is repeatedly cut off at various points, producing multiple variations of the same error, before finally working as expected.

One variation of error message produced:

Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 200 Keys:
 t Space " A v e r a g e Space f i l e Space s i z e : Space $ a v e r a g e S i z e K B Space K B " Enter
 Space Space Space Space W r i t e - H o s t Space " A v e r a g e Space f i l e Space s i z e : Space $ a v e r a g e S i z e M B Space M B " Enter
 Space Space Space Space W r i t e - H o s t Space " L a r g e s t Space f i l e Space s i z e : Space $ l a r g e s t S i z e M B Space M B " Enter
 Space Space Space Space W r i t e - H o s t Space " L a r g e s t Space f i l e Space p a t h : Space $ l a r g e s t F i l e " Enter
 } Enter


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 -8.
   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)

Other variations identical except different values for Actual value was X

Originally created by @wizardtoast on GitHub (May 24, 2023). ### Windows Terminal version 1.16.10261.0 ### Windows build number 10.0.19045.0 ### Other Software _No response_ ### Steps to reproduce 1. Copy code snippet with multiple lines of code ([code used](https://pastebin.com/fAyjy9h9)) 2. Ensure window height is small enough to require scrolling after pasting code 3. Paste code snippet into terminal ### Expected Behavior Code is pasted without error and terminal ready for next input ### Actual Behavior Code is repeatedly cut off at various points, producing multiple variations of the same error, before finally working as expected. One variation of error message produced: ``` Oops, something went wrong. Please report this bug with the details below. Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new ----------------------------------------------------------------------- Last 200 Keys: t Space " A v e r a g e Space f i l e Space s i z e : Space $ a v e r a g e S i z e K B Space K B " Enter Space Space Space Space W r i t e - H o s t Space " A v e r a g e Space f i l e Space s i z e : Space $ a v e r a g e S i z e M B Space M B " Enter Space Space Space Space W r i t e - H o s t Space " L a r g e s t Space f i l e Space s i z e : Space $ l a r g e s t S i z e M B Space M B " Enter Space Space Space Space W r i t e - H o s t Space " L a r g e s t Space f i l e Space p a t h : Space $ l a r g e s t F i l e " Enter } Enter 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 -8. 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) ``` Other variations identical except different values for `Actual value was X`
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 06:58:07 +00:00
Author
Owner

@zadjii-msft commented on GitHub (May 24, 2023):

This looks like a https://github.com/lzybkr/PSReadLine issue. Specifically I'm thinking https://github.com/PowerShell/PSReadLine/issues/1306. From their repo:

This issue was already fixed (see https://github.com/lzybkr/PSReadLine#1306). Please upgrade to the 2.2.6 version of PSReadLine from PowerShell Gallery. See the upgrading section for instructions. Please let us know if you run into the same issue with the latest version.

Does updating psreadline work/?

@zadjii-msft commented on GitHub (May 24, 2023): This looks like a https://github.com/lzybkr/PSReadLine issue. Specifically I'm thinking https://github.com/PowerShell/PSReadLine/issues/1306. From their repo: > This issue was already fixed (see https://github.com/lzybkr/PSReadLine#1306). Please upgrade to the [2.2.6 version of PSReadLine](https://www.powershellgallery.com/packages/PSReadLine/2.2.6) from PowerShell Gallery. See the [upgrading section](https://github.com/PowerShell/PSReadLine#upgrading) for instructions. Please let us know if you run into the same issue with the latest version. Does updating psreadline work/?
Author
Owner

@wizardtoast commented on GitHub (May 24, 2023):

Upgrading PSReadLine solved it, thanks!

@wizardtoast commented on GitHub (May 24, 2023): Upgrading PSReadLine solved it, thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19939