<h1 dir="auto">Environment</h1>
<p dir="auto">Windows build number: 10.0.18362<br>
Windows Terminal version (if applicable): 0.6.2951.0<br>
Powershell Version: 5.1.18362.145</p>
<h1 dir="auto">Steps to reproduce</h1>
<p dir="auto">Enter a PS Session, run some command that will cause the output to scroll past the bottom of the terminal window (for example, Get-Process), exit the PS Session, enter "clear" or "clear-host", then scroll up.  Part of the output from the command run in the PS Session will still be present in the scrollback buffer and cannot be removed or cleared without closing the tab.</p>
<p dir="auto">Example in code:</p>
<div class="highlight highlight-source-powershell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Enter-PSSession 1.1.1.1
for($i = 0; $i -lt 150; $i++){write-host $i} 
exit
clear-host
#scroll up in the terminal window"><pre class="notranslate"><span class="pl-c1">Enter-PSSession</span> <span class="pl-c1">1.1</span>.<span class="pl-c1">1.1</span>
<span class="pl-k">for</span>(<span class="pl-smi">$i</span> <span class="pl-k">=</span> <span class="pl-c1">0</span>; <span class="pl-smi">$i</span> <span class="pl-k">-lt</span> <span class="pl-c1">150</span>; <span class="pl-smi">$i</span><span class="pl-k">++</span>){<span class="pl-c1">write-host</span> <span class="pl-smi">$i</span>} 
<span class="pl-k">exit</span>
<span class="pl-c1">clear-host</span>
<span class="pl-c"><span class="pl-c">#</span>scroll up in the terminal window</span></pre></div>
<p dir="auto">The attached screenshot shows the contents of my scrollback buffer after running similar code and then running a clear-output command. You can see the output of the commands and the numbers 0-13 present in the scrollback buffer, as in my particular case the code caused the output window to scroll down 15 lines while in the PS Session.  At this point clear and clear-host will not be able to remove these 15 lines of output from the Scrollback Buffer.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/36894453/67905612-f1d09180-fb3f-11e9-93eb-52c66ac894df.png"><img src="https://user-images.githubusercontent.com/36894453/67905612-f1d09180-fb3f-11e9-93eb-52c66ac894df.png" alt="Windows Terminal Powershell Remote Session Bug" style="max-width: 100%;"></a></p>
<p dir="auto">Oddly enough it seems the issue is the same even if you run a "clear-host" while still inside of the PS Session.  But running a "clear-host" while inside the PS Session <em>does</em> work as long as the output hasn't caused the terminal window to scroll.</p>
<h1 dir="auto">Expected behavior</h1>
<p dir="auto">Entering a "clear" or "clear-host" command in PowerShell should clear the terminal window, including clearing the scrollback buffer of all output. This is the functionality of the cmdlet if running from a cmd window, the PowerShell app, and PS ISE.</p>
<h1 dir="auto">Actual behavior</h1>
<p dir="auto">When using the Windows Terminal to enter a PS session with another host, if the output from that session causes the terminal output to scroll down, upon exiting that PS Session and running a "clear" or "clear-host" command will not clear the first portion of the output from the PS session, equal to the number of lines that the ps session caused the window to scroll down.</p>
<h1 dir="auto">Other notes</h1>
<p dir="auto">I've tested this with PowerShell 5.1 in Windows 10 from the PowerShell app, cmdhost running powershell, and from PS ISE , it does not seem to occur in any other circumstances outside of the Windows Terminal, so I'm opening this as a Windows Terminal bug.  It's not critical, but pretty annoying if doing remote PowerShell work.</p>
<h1 dir="auto">Environment</h1>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Windows build number: Microsoft Windows NT 10.0.18362.0
Windows Terminal version (if applicable): 0.5.2762.0"><pre lang="none" class="notranslate"><code class="notranslate">Windows build number: Microsoft Windows NT 10.0.18362.0
Windows Terminal version (if applicable): 0.5.2762.0
</code></pre></div>
<h1 dir="auto">Steps to reproduce</h1>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# open Terminal with powershell
# open git repo with more than 100 commits
git log -100 # to fill in the entire screen with text
Clear-Host
# scroll up"><pre class="notranslate"><code class="notranslate"># open Terminal with powershell
# open git repo with more than 100 commits
git log -100 # to fill in the entire screen with text
Clear-Host
# scroll up
</code></pre></div>
<h1 dir="auto">Expected behavior</h1>
<p dir="auto">Cannot scroll up, <code class="notranslate">Clear-Host</code> cleared the terminal, all previous output is gone.</p>
<h1 dir="auto">Actual behavior</h1>
<p dir="auto">Scrolling up shows previous output. This repros with both Powershel 6.2.3 and 5.2.1.<br>
This does not happen with the powershell terminal, which correctly removes all previous output.</p>