<h1 dir="auto">Environment</h1>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Windows build number: [run &quot;ver&quot; at a command prompt]
**Microsoft Windows [Version 10.0.18362.207]**
OS language is dutch
Windows Terminal version (if applicable):
**Windows Terminal (Preview)
Version: 0.2.1831.0**

Any other software?"><pre lang="none" class="notranslate"><code class="notranslate">Windows build number: [run "ver" at a command prompt]
**Microsoft Windows [Version 10.0.18362.207]**
OS language is dutch
Windows Terminal version (if applicable):
**Windows Terminal (Preview)
Version: 0.2.1831.0**

Any other software?
</code></pre></div>
<h1 dir="auto">Steps to reproduce</h1>

<p dir="auto">full screen the terminal window and use the keys "windows + shift + arrow" to move the window to your second screen</p>
<h1 dir="auto">Expected behavior</h1>
<p dir="auto">Go full screen on second monitor</p>

<h1 dir="auto">Actual behavior</h1>
<p dir="auto">When I move it from a 1920x1080 screen to a 2560x1080 screen it goes full screen. When moving it from a 2560x1080 screen to a 1920x1080 screen the terminal crashes.</p>

<h1 dir="auto">Message event viewer (Dutch)</h1>
<p dir="auto">Naam van toepassing met fout: WindowsTerminal.exe, versie: 1.0.1907.2001, tijdstempel: 0x5d1bd2d0<br>
Naam van module met fout: ucrtbase.dll, versie: 10.0.18362.1, tijdstempel: 0x5cbddb81<br>
Uitzonderingscode: 0xc0000409<br>
Foutmarge: 0x000000000006d3be<br>
Id van proces met fout: 0x3028<br>
Starttijd van toepassing met fout: 0x01d534b9425f56b0<br>
Pad naar toepassing met fout: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_0.2.1831.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe<br>
Pad naar module met fout: C:\WINDOWS\System32\ucrtbase.dll<br>
Rapport-id: d822f0b0-3805-4c9f-b74e-87c80dc48334<br>
Volledige pakketnaam met fout: Microsoft.WindowsTerminal_0.2.1831.0_x64__8wekyb3d8bbwe<br>
Relatieve toepassings-id van pakket met fout: App</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 [Version 10.0.18362.295]
Windows Terminal version (if applicable): latest master"><pre lang="none" class="notranslate"><code class="notranslate">Windows build number: Microsoft Windows [Version 10.0.18362.295]
Windows Terminal version (if applicable): latest master
</code></pre></div>
<p dir="auto">This is a little tricky to describe--please bear with me.</p>
<p dir="auto">I've given the example repro using pwsh, but I have also checked with plain C++ code, compiled and then run from cmd, and it's still a problem (so pwsh/PSReadLine are not interfering).</p>
<h1 dir="auto">Steps to reproduce</h1>
<ol dir="auto">
<li>Create a string "s" with SGR sequences that sets foreground to red, and background color to white, and then at the end of the string an SGR reset (which should set fg and bg back to their defaults: gray on black).</li>
<li>Write the string to the console, and observe that it works as expected. After the content, the rest of the line (to the window edge) is black.</li>
<li>Now make the string longer by just adding content in the middle... long enough that it will wrap.</li>
<li>Write the string to the console, and observe that it works differently. After the end of the content, the rest of the line (to the window edge) is white.</li>
</ol>
<h1 dir="auto">Expected behavior:</h1>
<p dir="auto">The behavior should be the same, whether or not the line wraps. And I think the current behavior in the non-wrapping case seems correct.</p>
<h1 dir="auto">Actual behavior:</h1>
<p dir="auto">If the line wraps, the altered background color inexplicably shows up after the end of the content, to the end of the line.</p>
<h1 dir="auto">Example repro:</h1>
<div class="highlight highlight-source-powershell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$csi = &quot;`e[&quot;
$fgRed = &quot;${csi}91m&quot;
$bgWhite = &quot;${csi}107m&quot;
$reset = &quot;${csi}0m&quot;

$s = &quot;default ${fgRed}fg red ${bgWhite}bg white, no wrapping${reset} (courtesy reset)&quot;

$s

$s2 = &quot;default ${fgRed}fg red ${bgWhite}bg white, this content should be long enough to cause the line to be wrapped blah blah blah blah blah blah blah blah blah blah blah${reset} (courtesy reset)&quot;

$s2"><pre class="notranslate"><span class="pl-smi">$csi</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-cce">`e</span>[<span class="pl-pds">"</span></span>
<span class="pl-smi">$fgRed</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">${csi}</span>91m<span class="pl-pds">"</span></span>
<span class="pl-smi">$bgWhite</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">${csi}</span>107m<span class="pl-pds">"</span></span>
<span class="pl-smi">$reset</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">${csi}</span>0m<span class="pl-pds">"</span></span>

<span class="pl-smi">$s</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>default <span class="pl-smi">${fgRed}</span>fg red <span class="pl-smi">${bgWhite}</span>bg white, no wrapping<span class="pl-smi">${reset}</span> (courtesy reset)<span class="pl-pds">"</span></span>

<span class="pl-smi">$s</span>

<span class="pl-smi">$s2</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>default <span class="pl-smi">${fgRed}</span>fg red <span class="pl-smi">${bgWhite}</span>bg white, this content should be long enough to cause the line to be wrapped blah blah blah blah blah blah blah blah blah blah blah<span class="pl-smi">${reset}</span> (courtesy reset)<span class="pl-pds">"</span></span>

<span class="pl-smi">$s2</span></pre></div>
<p dir="auto">Picture:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/771085/64643004-64d14d80-d3c4-11e9-97fa-c7c1953ebf25.png"><img src="https://user-images.githubusercontent.com/771085/64643004-64d14d80-d3c4-11e9-97fa-c7c1953ebf25.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">And actually, it gets weirder: if I tweak the string's length such that the wrap occurs in the middle of the "courtesy reset" portion of the content... the bug does not repro.</p>