Copying multiline commands shows an error #4783

Closed
opened 2026-01-30 23:56:28 +00:00 by claunia · 2 comments
Owner

Originally created by @Jazzynupe on GitHub (Nov 2, 2019).

When copying and pasting a multiline command to the terminal. I get weird extra lines and terminal errors that command was not valid.

In particular this is related to PowerShell (5 and 6 core)

Even function definitions that are complex also show errors

Here is a sample response from Powershell when pasting the function to the console window

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:

g i t Space r e s e t Space o r i g i n / m a s t e r Enter
Ctrl+Enter Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space # g i t Space s t a t u s Enter
Ctrl+Enter Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space } Enter Ctrl+Enter Space Space Space Space Space Space Space Space Space Space Space Space } Enter
Ctrl+Enter Space Space Space Space Space Space Space Space } Space - E n d Space { Enter
Ctrl+Enter Space Space Space Space Space Space Space Space Space Space Space Space g e t - g i t s t a t u s Enter Ctrl+Enter Space Space Space Space Space Space Space Space } Enter
Ctrl+Enter Space Space Space Space } Enter
Ctrl+Enter Enter
Ctrl+Enter E n d Space { Enter
Ctrl+Enter Space Space Space Space Enter
Ctrl+Enter Space Space Space Space Enter
Ctrl+Enter Space Space Space Space p o p - L o c a t i o n Enter
Ctrl+Enter } Enter
Ctrl+Enter Enter
Ctrl+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 -111.
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(Nullable1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

-----------------------------------------------------------------------

However if I open the regular terminal window for Powershell, it works fine.

Originally created by @Jazzynupe on GitHub (Nov 2, 2019). When copying and pasting a multiline command to the terminal. I get weird extra lines and terminal errors that command was not valid. In particular this is related to PowerShell (5 and 6 core) Even function definitions that are complex also show errors Here is a sample response from Powershell when pasting the function to the console window ``` 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: ``` g i t Space r e s e t Space o r i g i n / m a s t e r Enter Ctrl+Enter Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space # g i t Space s t a t u s Enter Ctrl+Enter Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space Space } Enter Ctrl+Enter Space Space Space Space Space Space Space Space Space Space Space Space } Enter Ctrl+Enter Space Space Space Space Space Space Space Space } Space - E n d Space { Enter Ctrl+Enter Space Space Space Space Space Space Space Space Space Space Space Space g e t - g i t s t a t u s Enter Ctrl+Enter Space Space Space Space Space Space Space Space } Enter Ctrl+Enter Space Space Space Space } Enter Ctrl+Enter Enter Ctrl+Enter E n d Space { Enter Ctrl+Enter Space Space Space Space Enter Ctrl+Enter Space Space Space Space Enter Ctrl+Enter Space Space Space Space p o p - L o c a t i o n Enter Ctrl+Enter } Enter Ctrl+Enter Enter Ctrl+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 -111. 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, CancellationToken cancellationToken) ``` ----------------------------------------------------------------------- ``` However if I open the regular terminal window for Powershell, it works fine.
claunia added the Resolution-Duplicate label 2026-01-30 23:56:28 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Nov 2, 2019):

Please search for existing issues. /dup #1091.

@DHowett-MSFT commented on GitHub (Nov 2, 2019): Please search for existing issues. /dup #1091.
Author
Owner

@ghost commented on GitHub (Nov 2, 2019):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Nov 2, 2019): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4783