terminal: Copy and paste from the Windows Terminal doesn't include line breaks
Environment
Windows build number: 10.0.18362.116
Windows Terminal version (if applicable): 71e19cd + changing toolset to v142 and SDK version
Steps to reproduce
- Clone, build, package, install and launch Windows Terminal (DevBuild).
- Execute
docker run --rm -it mcr.microsoft.com/windows/nanoserver:1903 - Select multiple lines and right click.
- Paste in any text editor. I used VSCode.
Expected behavior
I expected to see the same thing I saw in the terminal - specifically multiple lines.
Actual behavior
One line with lots of space.
Notes
This is different from #65 since it was about conhost and I’m talking about the new terminal, and I didn’t have Shift pressed.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 51
- Comments: 71 (17 by maintainers)
This is a pretty brutal bug. Just a note to help indicate criticality.
@zadjii-msft There’s some terminal state change that causes it. Repro steps:
I’ve been well aware of this working on the clipboard stuff, but haven’t tracked down the bug yet. The bug probably manifests in TextBuffer::GetTextForClipboard, but I haven’t had the time to debug it yet.
I’ve been using the Windows Terminal now since it was first pushed, all the way back to when I had to compile each version and this has never worked. Attempting to copy and paste using the shortcuts has issues and the default ctrl+c ctrl+v functionality clearly has problems as well. Combine that with the related issues caused by WSL and I have to question who this is even being built for at this point.
Its nice that you have CI/CD going but clearly its not got great regression testing because I’ve seen some variant of this bug open/closed/ and then reopened the whole time with no comprehensive solutions. What I don’t understand is how every time I’ve been able to reproduce it easily within minutes so how is this code getting pushed without being tested? it seems to me that this is all hamstrung to issues inherent in ConPTY which hasn’t seen a push in 5 months which smells of project priority issues to me and really should have had a solid year of work on it before this ever saw the light of day on github, because pushing a Terminal that can’t even copy and paste at half a year in is paramount to saying “hopefully someone else will fix this for me in the open source community” which is a perfectly fine request of a 1.0 > project with promised features delivered but somewhat distasteful at what appears to be a prototyping phase.
For those of us who are using this to SSH into *nix systems and use vim on our windows box at work which I assume is quite a few of us, or are prototyping in WSL even if just for small things…this piece of software is effectively useless until it can at least pretend to have basic parity with a *nix terminal or even the CMD. Even trying to copy and paste in a CMD session between two files in windows is a dubious proposition at best which makes this an inferior product to the default command prompt bundled with the OS currently.
I don’t need tabs, I don’t need Acrylic, I don’t need some cool new font, in fact the one aesthetic thing that would have been nice was an actual settings menu instead of a profile.json which is another ticket that has been open for months in various states of incomplete.
In summary I need your product to work at a fundamental level where I can actually use it! I don’t expect it to be perfect or bug free at any point but its clear you’ve focused on the wrong things when determining who would want this, what for, and why because currently its just a sad conversation piece about what could have been and talk about how excited and naive we were to think this would turn out well in 6 months.
This is a huge issue, how anybody can be working with this tool, please fix ASAP…
To those who are impatient and contributing nonsense like ‘Copying and pasting works in Putty, it should work here!’, do consider that the developers of this are dealing with higher severity issues: crashes, freezing, rendering issues, etc. Those critical issues can rightfully take priority over this. If you want this resolved sooner, you can help debug the issue, apply to their development team, or contribute your own code.
/$0.02
Looks like this one will be fixed shortly.
Thank you, @d-bingham, from all of us waiting on the issue.
Now, can we get feature to move tabs around by using cursor and if you have many tabs they don’t hide behind ‘+’ character please! LOL 💃
At this exact moment, we’ve been focusing on making sure the in-box console continues to work well for the upcoming release of Windows. Sorry about the radio silence! 😃
I think I found an easier reproduce steps.
clsto clear the screendirI’m seeing this as well. My shell is Powershell Core 6.2.0 and everything I try to copy has this problem. It seems that the copy functionality copies the whole buffer. Ie, if I’m trying to copy this:
It copies this, where
^denotes a space and my terminal is 30 chars wide:Everyone relax, this is a beta product, don’t use it for production. There are other Microsoft terminal programs that function properly so just use those while this isn’t working.
This bug is not related to pasting into Terminal, it is pasting from Terminal. I believe what you’re referring to is discussed in #1091.
To give credit where credit is due, that fix is thanks to @d-bingham. 😸
I hope you are kidding, you have major bug that affect the way people interact with the tool and there is no focus on fixing it but you do have time to upgrading it to new windows versions…
I still get this copying from Ubuntu 18.04 on latest version of WSL (in Windows10) and pasting to stackoverflow/pastebin in Firefox (latest), and NotePad (latest). Getting one giant line.
With the current release when I cut and paste I get one giant line with no linebreaks at all.
meet this in terminal 1.0 wsl2 ubuntu 18.04
PS:
Still not fixed, when you copy it will add new line.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: Carlos Zamora notifications@github.com Sent: Friday, October 18, 2019 5:45:03 AM To: microsoft/terminal terminal@noreply.github.com Cc: mikkushukla shubhanshu.shukla@live.com; Comment comment@noreply.github.com Subject: Re: [microsoft/terminal] Copy and paste from the Windows Terminal doesn’t include line breaks (#1073)
Closed #1073https://github.com/microsoft/terminal/issues/1073 via #3239https://github.com/microsoft/terminal/pull/3239.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/terminal/issues/1073?email_source=notifications&email_token=ADAODLTW7NICSNEHDRSD27LQPD5YPA5CNFSM4HRMLYM2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOUJH2SOY#event-2723129659, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADAODLU24DCANWUUX332TNDQPD5YPANCNFSM4HRMLYMQ.
This is the basic need of any ssh client l, we can take learning from putty how consistently it is working. Even Android client are good at copy paste.
Get Outlook for Androidhttps://aka.ms/ghei36
From: Dustin L. Howett (MSFT) notifications@github.com Sent: Thursday, October 17, 2019 7:56:38 AM To: microsoft/terminal terminal@noreply.github.com Cc: mikkushukla shubhanshu.shukla@live.com; Comment comment@noreply.github.com Subject: Re: [microsoft/terminal] Copy and paste from the Windows Terminal doesn’t include line breaks (#1073)
At this exact moment, we’ve been focusing on making sure the in-box console continues to work well for the upcoming release of Windows. Sorry about the radio silence! 😃
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/terminal/issues/1073?email_source=notifications&email_token=ADAODLUGBQ42JRZMXUZCLVDQO7EN5A5CNFSM4HRMLYM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBOQSNY#issuecomment-542968119, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADAODLU23SF7FIZ6W7AQ52LQO7EN5ANCNFSM4HRMLYMQ.
For me the paste problem is also not resolved 😦
I just wanted to add I’m also seeing this issue with Windows Terminal 0.4.2382.0. I can confirm previous comments are correct. Issue seems related to state and affects tabs individually. I can reproduce quickly using both cmd and PowerShell using the
clsmethod posted above, and my WSL immediately falls into the bad state on start (I assume based on my shell setup). After the tab gets into a bad state, it appears to not recover. Only way I have been able to reliably fix the issue is closing and re-opening the tab.This isn’t a set of reproduction steps, but on WSL I’m running zsh with “oh my zsh”, “af-magic” theme, and “zsh-syntax-highlighting” plugin. Copy+paste is immediately broken on any command (no newlines, lots of whitespace). Perhaps that helps someone create a faster test.
I ssh into a linux server, and need to copy-paste some text both ways. When copying from notepad and pasting into the terminal window, there are empty lines between lines. When copying from terminal window and pasting into Notepad++, the newlines are gone, and there are spaces for all the selected area - that means the size of the pasted text is dependent on the terminal window size at the time of copying.
Just as a remark: when I use a Powershell window for ssh, copypaste works great, without any of these issues.
I’ve tried all the workarounds I’ve seen listed, from ctrl-c, shift-ctrl-c, right clicks, shift right clicks, etc, but I’m having an absolute nightmare with pasting out of WSL.
It’s definitely not handling newlines right, and sometimes when I paste stuff into neovim I get an extra line between every single line. It’s very weird, it’s almost enough to stop me using the terminal at this point. 😦
I’m also facing this issue when running WSL Ubuntu distribution. If I open a WSL tab in Windows Terminal and run something like
ls -1, then copy some lines using my mouse (hold left-click, drag, then right-click), the copied text does not include any newlines.Note that if I directly open WSL Ubuntu (standalone, NOT inside Windows Terminal), copying works fine (the newlines are included).
I also have this issue when copying text out of an SSH session to a Linux host.
Currently working around it by having this script on my desktop and giving it a double click when I have something I need to paste out of Terminal:
@mikkushukla
The problem you described is not related to this issue.
yes, I can confirm that still doesn’t work on
v0.6.2951.0Copy from VSCode and paste in Windows Terminal on vim:
If you want to stay in ubuntu subsystem, ubuntu one is the only option however as we all know it is basic so we all have been hoping that The Terminal could be the tool.
Please prove us right 😃
This is community’s feedback which tries to use the tool, i think the major frustration is that nothing is happening on tool side, especially for major bug as this which was reported months ago…
Would be nice if somebody just let us know that you guys are looking into it.
LOL, which ones???
Is nobody working on this?
Check out this blog post
@mikkushukla, please open a new issue to report the problem: https://github.com/microsoft/terminal/issues
Terminal freezes during post laptop sleep and network disconnect. Every time I have to force kill the app via task manager. Is this a known issue?
Get Outlook for Androidhttps://aka.ms/ghei36
From: Dustin L. Howett (MSFT) notifications@github.com Sent: Monday, November 18, 2019 12:53:38 PM To: microsoft/terminal terminal@noreply.github.com Cc: mikkushukla shubhanshu.shukla@live.com; Comment comment@noreply.github.com Subject: Re: [microsoft/terminal] Copy and paste from the Windows Terminal doesn’t include line breaks (#1073)
For what it’s worth: if multiple terminal emulators experience the same issue, it’s probably something in your shell.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/terminal/issues/1073?email_source=notifications&email_token=ADAODLWZX7H3UFMSROGFRMDQUI7HVA5CNFSM4HRMLYM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEJOGGA#issuecomment-554885912, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADAODLS7INF25WKKKYX3USTQUI7HVANCNFSM4HRMLYMQ.
From: Dustin L. Howett (MSFT) notifications@github.com Sent: Monday, November 18, 2019 12:53:38 PM To: microsoft/terminal terminal@noreply.github.com Cc: mikkushukla shubhanshu.shukla@live.com; Comment comment@noreply.github.com Subject: Re: [microsoft/terminal] Copy and paste from the Windows Terminal doesn’t include line breaks (#1073)
For what it’s worth: if multiple terminal emulators experience the same issue, it’s probably something in your shell.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/terminal/issues/1073?email_source=notifications&email_token=ADAODLWZX7H3UFMSROGFRMDQUI7HVA5CNFSM4HRMLYM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEJOGGA#issuecomment-554885912, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADAODLS7INF25WKKKYX3USTQUI7HVANCNFSM4HRMLYMQ.
Even putty like copy paste is not working in windows terminal, copy multiline text and it will paste your content with extra \n per line which is very irritating, every time i have to delete extra line.
Yes you are right freeze is very common whenever ssh host startresponding slowly.
Get Outlook for Androidhttps://aka.ms/ghei36
From: Ian notifications@github.com Sent: Friday, October 18, 2019 1:17:29 AM To: microsoft/terminal terminal@noreply.github.com Cc: mikkushukla shubhanshu.shukla@live.com; Comment comment@noreply.github.com Subject: Re: [microsoft/terminal] Copy and paste from the Windows Terminal doesn’t include line breaks (#1073)
To those who are impatient and contributing nonse like ‘Copying and pasting works in Putty, it should work here!’, do consider that the developers of this are dealing with higher severity issues crashes, freezing, rendering issues, etc. Those critical issues can rightfully take priority over this. If you want this resolved sooner, you can help debug the issue, apply to their development team or contribute your own code.
/$0.02
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/terminal/issues/1073?email_source=notifications&email_token=ADAODLWN7TLHEIOOMRPJNZDQPC6NDA5CNFSM4HRMLYM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBRJTJY#issuecomment-543332775, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADAODLWJEYW4VX454NKCLETQPC6NDANCNFSM4HRMLYMQ.
Well technically this software is still in preview stage and not even stable yet…
Take learning from mac terminal, if you are building a good echo system, you should focus on terminal. Event open-source ubuntu terminal work like charm.
Get Outlook for Androidhttps://aka.ms/ghei36
From: Peter notifications@github.com Sent: Thursday, October 17, 2019 9:35:13 PM To: microsoft/terminal terminal@noreply.github.com Cc: mikkushukla shubhanshu.shukla@live.com; Comment comment@noreply.github.com Subject: Re: [microsoft/terminal] Copy and paste from the Windows Terminal doesn’t include line breaks (#1073)
I hope you are kidding, you have major bug that affect the way people interact with the tool and there is no focus on fixing it but you do have time to upgrading it to new windows versions…
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/terminal/issues/1073?email_source=notifications&email_token=ADAODLSPOOGMH47FQGRWRMDQPCELTA5CNFSM4HRMLYM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBQUG7I#issuecomment-543245181, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADAODLRUZT746SIJAZRJISDQPCELTANCNFSM4HRMLYMQ.
This problem appeared in a DOS window with my upgrade to 1903. Is the DOS window code driving this? I can no longer copy out of my Hessling editor. I am ok if I save the file and use notepad but this is a real nuisance.
On 10/16/2019 10:46 PM, mikkushukla - notifications@github.com wrote:
On Windows 10 Pro (version 1903), using Windows Terminal (version 0.5.2762.0) and PowerShell Core (version 6.2.2), I am having the same problem. I connect to multiple Linux-based systems in my daily job, this issue prevents me from copy-and-paste commands/ text effectively.
Yeah. I didn’t realize it was a dup until after I fixed it. The PR that fixed it was #2797. #2755 was an incorrect approach to solving this problem.
Same problem in a DOS window. Totally unusable. I copy out of my text editor in a DOS window and paste into a text email within Thunderbird and I have garbage. It worked up until I upgraded to 1903. This needs to be fixed. Or add an option. This might be useful when pasting into a word processor where you want to reformat but not the way I use it. I have been able to use this capability for many years and now it is broken.
Me too. This is the one feature (copying from terminal) that I rely on heavily, so I can’t really use this until it’s fixed. 😐