<h1 dir="auto">Environment</h1>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Windows build number: Version 10.0.18362.175
Windows Terminal version (if applicable): 0.2.1831.0"><pre lang="none" class="notranslate"><code class="notranslate">Windows build number: Version 10.0.18362.175
Windows Terminal version (if applicable): 0.2.1831.0
</code></pre></div>
<h1 dir="auto">Steps to reproduce</h1>
<ol dir="auto">
<li>
<p dir="auto">Set the <code class="notranslate">HKCU\Console\VirtualTerminalLevel</code> registry entry to 1, to enable support for VT escape sequences by default.</p>
</li>
<li>
<p dir="auto">Makes sure the <code class="notranslate">initialCols</code> option in the Windows Terminal profile is set to 120.</p>
</li>
<li>
<p dir="auto">Open a <strong>cmd</strong> shell in the Windows Terminal (this can't be a WSL bash shell - it must be something that would usually not have VT support enabled without the registry setting).</p>
</li>
<li>
<p dir="auto">Run the following Python script:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import sys
sys.stdout.write('X'*(120-10))
sys.stdout.write('\033[1;34;47mHello\033[m\n')"><pre class="notranslate"><code class="notranslate">import sys
sys.stdout.write('X'*(120-10))
sys.stdout.write('\033[1;34;47mHello\033[m\n')
</code></pre></div>
</li>
</ol>
<h1 dir="auto">Expected behavior</h1>
<p dir="auto">I'd expect this to display 110 X's followed by the word <em>Hello</em>, in blue on white, on the same line. This is what it looks like in a regular console cmd shell.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/4181424/61186979-b038db00-a663-11e9-8b49-1abf23aa1b88.png"><img src="https://user-images.githubusercontent.com/4181424/61186979-b038db00-a663-11e9-8b49-1abf23aa1b88.png" alt="image" style="max-width: 100%;"></a></p>
<h1 dir="auto">Actual behavior</h1>
<p dir="auto">What actually happens in the Windows Terminal is the <em>Hello</em> is displayed on the following line.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/4181424/61186985-c34bab00-a663-11e9-8ec8-3c714497d803.png"><img src="https://user-images.githubusercontent.com/4181424/61186985-c34bab00-a663-11e9-8ec8-3c714497d803.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">I don't have a good understanding of how the conpty stuff works, but my theory is that the escape sequences aren't actually being processed initially, and are just written out to the screen as literal characters. As a result the <em>Hello</em> is forced to wrap onto the next line, because there isn't enough space remaining. This screen structure is then passed through conpty somehow, at which point the escape sequences are processed and the text colors changed. But by that stage the wrapping has already taken effect, so the text is in the wrong place.</p>
<p dir="auto">It's easier to see what's going on if you apply PR <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="467842317" data-permission-text="Title is private" data-url="https://github.com/microsoft/terminal/issues/1964" data-hovercard-type="pull_request" data-hovercard-url="/microsoft/terminal/pull/1964/hovercard" href="https://github.com/microsoft/terminal/pull/1964">#1964</a> first. In that case, the ESC character gets translated to a ← when it isn't initially interpreted as an escape sequence. The other side of the conpty pipe then doesn't get a second chance to process those values as an escape sequence, so you just see the raw characters being written out.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/4181424/61187019-2f2e1380-a664-11e9-85fe-f0a656c47e67.png"><img src="https://user-images.githubusercontent.com/4181424/61187019-2f2e1380-a664-11e9-85fe-f0a656c47e67.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">This may be a good reason to reject PR <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="467842317" data-permission-text="Title is private" data-url="https://github.com/microsoft/terminal/issues/1964" data-hovercard-type="pull_request" data-hovercard-url="/microsoft/terminal/pull/1964/hovercard" href="https://github.com/microsoft/terminal/pull/1964">#1964</a> for now, since it's clearly making the situation worse, but I think the real issue is in the conpty code, and if that were fixed then the PR might well be safe to merge.</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): Version: 0.4.2382.0

Any other software?"><pre lang="none" class="notranslate"><code class="notranslate">Windows build number: Microsoft Windows [Version 10.0.18362.295]
Windows Terminal version (if applicable): Version: 0.4.2382.0

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

<p dir="auto">say we have<br>
"<br>
Line 1<br>
Line 2<br>
Line 3<br>
"<br>
on screen.<br>
use Mouse to select multiple lines in the windows terminal and right click (or ctrl + c). Then paste it into either a text editor such as sublime in windows or paste back into the terminal using right click again.</p>
<p dir="auto">all the lines become one line with lots of spaces adding in between. such as<br>
"Line 1             SPACE  SPACE   SPACE   SPACE   SPACE  SPACE                                                                                                     Line 2   SPACE      SPACE      SPACE      SPACE      SPACE      SPACE      SPACE      SPACE      SPACE                                                                                                       Line 3                                                                  "</p>
<h1 dir="auto">Expected behavior</h1>
<p dir="auto">The right output should be<br>
"<br>
Line 1\newline<br>
Line 2\newline<br>
Line 3\newline<br>
"</p>
<p dir="auto">This makes it really really hard to use windows terminal, since we do need to copy and paste multiple lines a lot. Say people ask you send them your stuffs in some linux env, you open the file, then you want to just be able to select lines and copy them, then paste into an email/chat app in windows. Now, all lines are becoming just one line, which is bad..</p>

<h1 dir="auto">Actual behavior</h1>

<p dir="auto">all the lines become one line with lots of spaces adding in between. such as<br>
"Line 1 SPACE SPACE SPACE SPACE SPACE SPACE Line 2 SPACE SPACE SPACE SPACE SPACE SPACE SPACE SPACE SPACE Line 3 "</p>