<h1 dir="auto">Environment</h1>
<p dir="auto">Windows 10, PS 6, Windows Terminal.</p>
<p dir="auto">Win32NT             10.0.18362.0 Microsoft Windows NT 10.0.18362.0<br>
PSVersion                      5.1.18362.145<br>
BuildVersion                   10.0.18362.145<br>
Windows Terminal version 0.6.2951.0</p>
<p dir="auto">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.</p>
<p dir="auto"><code class="notranslate">{ "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bc}", "name": "SPO PowerShell", "commandline": "powershell.exe -NoExit -Command \"Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking;\" ", "hidden": false },</code></p>
<h1 dir="auto">Steps to reproduce</h1>
<p dir="auto">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.<br>
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.</p>
<p dir="auto">I've tried:<br>
$MyDocs = [environment]::getfolderpath("mydocuments")</p>
<p dir="auto">`<br>
$Dlls = ("$MyDocs\ISAPI16\05Microsoft.SharePoint.Client.Runtime.dll",<br>
"$MyDocs\ISAPI16\02Microsoft.SharePoint.Client.Publishing.dll",<br>
"$MyDocs\ISAPI16\04Microsoft.SharePoint.Client.Taxonomy.dll",<br>
"$MyDocs\ISAPI16\31Microsoft.SharePoint.Security.dll",<br>
"$MyDocs\ISAPI16\09Microsoft.SharePoint.Client.UserProfiles.dll")'</p>
<p dir="auto">and with single backticks after each line (edit: as Quotes are designated by backticks, they've been stripped from this code entry, but they <strong><em>were</em></strong> there, and produce the same result<br>
$MyDocs = [environment]::getfolderpath("mydocuments")</p>
<p dir="auto"><code class="notranslate">$Dlls = ("$MyDocs\ISAPI16\05Microsoft.SharePoint.Client.Runtime.dll",</code><br>
"$MyDocs\ISAPI16\02Microsoft.SharePoint.Client.Publishing.dll",<code class="notranslate"> "$MyDocs\ISAPI16\04Microsoft.SharePoint.Client.Taxonomy.dll",</code><br>
"$MyDocs\ISAPI16\31Microsoft.SharePoint.Security.dll",`<br>
"$MyDocs\ISAPI16\09Microsoft.SharePoint.Client.UserProfiles.dll")'</p>
<h1 dir="auto">Expected behavior</h1>
<p dir="auto">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.</p>
<h1 dir="auto">Actual behavior</h1>
<p dir="auto">Interpreted as a series of incomplete commands, 1 per line.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/25006517/68110657-4f206600-fee5-11e9-8483-3adadd5b16e9.png"><img src="https://user-images.githubusercontent.com/25006517/68110657-4f206600-fee5-11e9-8483-3adadd5b16e9.png" alt="Line breaking bug" style="max-width: 100%;"></a></p>
<p dir="auto">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</p>
<h1 dir="auto">Tags</h1>
<p dir="auto">#PowerShell</p>
<p dir="auto">When copying and pasting a multiline command to the terminal. I get weird extra lines and terminal errors that command was not valid.</p>
<p dir="auto">In particular this is related to PowerShell (5 and 6 core)</p>
<p dir="auto">Even function definitions that are complex also show errors</p>
<p dir="auto">Here is a sample response from Powershell when pasting the function to the console window</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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:"><pre class="notranslate"><code class="notranslate">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:
</code></pre></div>
<p dir="auto">g i t Space r e s e t Space o r i g i n / m a s t e r Enter<br>
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<br>
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<br>
Ctrl+Enter Space Space Space Space Space Space Space Space } Space - E n d Space { Enter<br>
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<br>
Ctrl+Enter Space Space Space Space } Enter<br>
Ctrl+Enter Enter<br>
Ctrl+Enter E n d Space { Enter<br>
Ctrl+Enter Space Space Space Space Enter<br>
Ctrl+Enter Space Space Space Space Enter<br>
Ctrl+Enter Space Space Space Space p o p - L o c a t i o n Enter<br>
Ctrl+Enter } Enter<br>
Ctrl+Enter Enter<br>
Ctrl+Enter }</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
Exception:"><pre class="notranslate"><code class="notranslate">
Exception:
</code></pre></div>
<p dir="auto">System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.<br>
Parameter name: top<br>
Actual value was -111.<br>
at System.Console.SetCursorPosition(Int32 left, Int32 top)<br>
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)<br>
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()<br>
at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)<br>
at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable<code class="notranslate">1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary</code>2 dispatchTable, Boolean ignoreIfNoAction, Object arg)<br>
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()<br>
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="-----------------------------------------------------------------------"><pre class="notranslate"><code class="notranslate">-----------------------------------------------------------------------
</code></pre></div>
<p dir="auto">However if I open the regular terminal window for Powershell, it works fine.</p>