terminal: Copy inconsistently copies as "copyTextWithoutNewlines"

Environment

Windows build number: Version 10.0.18362.239
Windows Terminal version: 0.3.2142.0

Steps to reproduce

  1. Launch cmd and run following command:
C:\>set path
  1. Using mouse highlight from 1,1 -> end of the terminal
  2. Right-click (or CTRL+SHIFT+C) to copy text

Expected behavior

Newlines to be copied


c:\project-system>set path                                                                                                                                                                                    
Path=C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\IDE\CommonExtensions\Microsoft\FSharp\;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\Tools\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Git\cmd;C:\Users\davkean\AppData\Local\Microsoft\WindowsApps;C:\Users\davkean\.dotnet\tools                                                                   
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC 

Actual behavior

Newlines are thrown away:

                                                                                                                                                                                                              c:\>set path                                                                                                                                                                                    Path=C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\IDE\CommonExtensions\Microsoft\FSharp\;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\master\Common7\Tools\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Git\cmd;C:\Users\davkean\AppData\Local\Microsoft\WindowsApps;C:\Users\davkean\.dotnet\tools                                                                   PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC 

I’ve confirmed that @drewnoakes and @davidwengier can also reproduce this. Occasionally it will copy the newlines but have not been able to figure out logic.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 15 (5 by maintainers)

Most upvoted comments

hi, I’m using the version v0.5.2661.0 and I can confirm that the copy problem is resolved but when I try to paste multiple lines in the terminal (on vim, nano, etc…) one extra new line is added after every line.

image

Sometimes I can repro this, sometimes I can’t.

I’m using bash in WSL 1 Ubuntu 18.04.

I’m generating 4 lines using:

echo -e "echo a\necho b\necho c\n"

From there, I select the 3 “echo” lines and copy them.

Then I paste them back.

Sometimes I get:

image

which is correct, sometimes I get this instead:

image

which is incorrect.

When I launch a new tab, the behavior is always correct.

If I use “clear” in bash to clear the terminal, the behavior is from there on always incorrect.

HTH

I have this problem on version 0.5.2681.0, copying from Terminal (Pengwin), and pasting back into Terminal (vim) or VSCode. I haven’t found a scenario where it does work correctly.

It seems like this issue is not solved for me. When I select text, righ-click it and paste, it’s all pasted as ‘a single line’… Version is 0.5.2681.0. Makes it very hard to use vim in a productive way…