Issue 1:
Environment

Windows 10, PS 6, Windows Terminal.

Win32NT 10.0.18362.0 Microsoft Windows NT 10.0.18362.0

PSVersion 5.1.18362.145

BuildVersion 10.0.18362.145

Windows Terminal version 0.6.2951.0

In addition to trying the ootb PowerShell experience, I've added in a profile matching my SharePoint Online Management Shell shortcut (other than the GUID which I just modified from the standard PS one). Behaviour below replicated in both windows/environments.

{ "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bc}", "name": "SPO PowerShell", "commandline": "powershell.exe -NoExit -Command \"Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking;\" ", "hidden": false },

Steps to reproduce

Fairly simple really, I have a variable assignment in PowerShell that breaks over multiple lines for readability, but PS in Terminal interprets as multiple commands.

I completely accept there may be a simple modification to the way I've been doing it that'll make it work in PS as delivered by Windows terminal. Problem may be sitting between chair and keyboard.

I've tried:

$MyDocs = [environment]::getfolderpath("mydocuments")

`

$Dlls = ("$MyDocs\ISAPI16\05Microsoft.SharePoint.Client.Runtime.dll",

"$MyDocs\ISAPI16\02Microsoft.SharePoint.Client.Publishing.dll",

"$MyDocs\ISAPI16\04Microsoft.SharePoint.Client.Taxonomy.dll",

"$MyDocs\ISAPI16\31Microsoft.SharePoint.Security.dll",

"$MyDocs\ISAPI16\09Microsoft.SharePoint.Client.UserProfiles.dll")'

and with single backticks after each line (edit: as Quotes are designated by backticks, they've been stripped from this code entry, but they were there, and produce the same result

$MyDocs = [environment]::getfolderpath("mydocuments")

$Dlls = ("$MyDocs\ISAPI16\05Microsoft.SharePoint.Client.Runtime.dll",

"$MyDocs\ISAPI16\02Microsoft.SharePoint.Client.Publishing.dll", "$MyDocs\ISAPI16\04Microsoft.SharePoint.Client.Taxonomy.dll",

"$MyDocs\ISAPI16\31Microsoft.SharePoint.Security.dll",`

"$MyDocs\ISAPI16\09Microsoft.SharePoint.Client.UserProfiles.dll")'

Expected behavior

In my regular PowerShell console and in SharePoint Online Management Console it assigns a variable with a collection of paths, which can be iterated through with foreach.

Actual behavior

Interpreted as a series of incomplete commands, 1 per line.

Can of course be mitigated by replacing all commands broken over multiple lines with the same commands on a single line, so not P0, but fairly annoying, as I have quite a few, including a giant if() statement

Tags

#PowerShell

Issue 2:
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.