Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy and paste in bash generates one single line #2324

Closed
havidarou opened this issue Aug 7, 2019 · 17 comments
Closed

Copy and paste in bash generates one single line #2324

havidarou opened this issue Aug 7, 2019 · 17 comments
Assignees
Labels
Area-Interaction Interacting with the vintage console window (as opposed to driving via API or hooks) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Milestone

Comments

@havidarou
Copy link

Environment

Windows build number: Microsoft Windows [Version 10.0.18362.239]
Windows Terminal version (if applicable): Version: 0.3.2171.0

Using bash within Windows terminal.

Steps to reproduce

Copy several text lines and paste them using vi text editor in bash (WSL).

Expected behavior

Properly copied lines within the text editor.

Actual behavior

A single line is generated with spaces so that it looks like they are different lines.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Aug 7, 2019
@havidarou
Copy link
Author

Just to clarify, this happens when copying lines from within a file in vi to the very same file in vi.

If I copy text lines from outside (let's say, Visual Code) to vi, then this is what happens:

Line1

Line2

Line3

I get a jump line in between every line that I am copying.

@carlos-zamora
Copy link
Member

So, clipboard keybindings copy/paste came in with PR #1093. There's two copy actions copy and copyTextWithoutNewlines. With mouse copy, holding SHIFT differentiates the two. With keyboard copy, these are two separate keybound options.

Given this information...

  • if you try to mouse copy with(out) SHIFT, does that fix the issue?
  • if you try to keyboard copy with one copyTextWithoutNewlines (vs copy), does that fix the issue?

Let me know below. Thanks!

@carlos-zamora carlos-zamora added Area-Interaction Interacting with the vintage console window (as opposed to driving via API or hooks) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Aug 7, 2019
@havidarou
Copy link
Author

havidarou commented Aug 8, 2019

I tried copying with and without shift by using the mouse: same result.
I did the same thing with the keyboard: same result.

This basically renders useless editing text within the terminal in any Linux system : /

Also, copying several lines from outside the terminal creates a jump line in between every line you copy (and it doesn't matter if you use CRLF or only LF).

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Aug 8, 2019
@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Aug 8, 2019
@havidarou havidarou reopened this Aug 8, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Aug 8, 2019
@johanburati
Copy link

johanburati commented Aug 9, 2019

Having the same issue you select a couple of lines from Windows Terminal, click the right button, go to notepad, do Ctrl-V and everything ends up on one line with spaces in between.

image

@jonneolie
Copy link

jonneolie commented Aug 14, 2019

I'm having a simular issue, but instead of that everything gets pasted into a single line.. when i paste i get after every line, an extra new line...

After i copy from a file/site or notepad etc. into the terminal with the Ubuntu app configured, i get an extra new line between every line.

When i open the Ubuntu app self, i can paste without any extra new lines.

-- same issue as havidarou. and same result with:
I tried copying with and without shift by using the mouse: same result.
I did the same thing with the keyboard: same result.

@havidarou
Copy link
Author

Hi, I also mentioned that
there are two kind of behaviors:

  1. Copying from within the terminal -> generates a single line with spaces.
  2. Copying from outside the terminal -> you get an extra line between every line.

@polyisobutylene
Copy link

When copying from a text editor (ex. vscode) spaces between lines will still be generated even if the file is using LF line endings
image

Copying out of the terminal into a text editor does not add proper newlines as expected
image

On further review it also appears to add all of the whitespace after the content on each line (more space added the wider the terminal is)
image

@ghost
Copy link

ghost commented Aug 16, 2019

I am seeing this is not just related to bash. Within Powershell 5, powershell core 6 and 7 running in windows terminal, I am getting very inconsistent copy/paste behavior. Extra whitespace, and missing line endings. The whitespace and (missing)line endings are in different places if i resize the terminal window and re-generate the output and copy/paste once again.

Sometimes all lines of output might be pasted as 1 single line, other times, it may paste 6 lines correctly before it begins to start missing line endings, and running lines together

Reproduced by copying any multi-line output from terminal and pasting it into Notepad++ or vscode

@aebian
Copy link

aebian commented Aug 19, 2019

Can confirm this behaviour.

@hteibler
Copy link

If you paste the output of a table ( with \t and \n )
image
in LibreOffice
all \t and \n are replaced with spaces ???
image

@ccarv
Copy link

ccarv commented Aug 27, 2019

Also can confirm this behavior. It is very inconsistent with utilities like vi. Pasting into nano via the terminal seems to yield better results than vi. Switched over to a raw Powershell console and vi copy and paste works just fine.

@zadjii-msft zadjii-msft removed the Needs-Attention The core contributors need to come back around and look at this ASAP. label Aug 27, 2019
@zadjii-msft zadjii-msft added this to the Terminal 1909 milestone Aug 27, 2019
@genio
Copy link

genio commented Aug 29, 2019

This is the single most frustrating thing about Terminal that makes it mostly unusable. I can live with the little UI glitches, but this is pure frustration.

@nitinyadav745
Copy link

I am also facing the same issues as reported above in thread. I am primarily using powershell core 6 as primary profile in terminal . This inconsistent behaviour renders windows terminal useless for sysadmins. This is one tool which has huge potential as it gives you option for multiple tabs.

@termski
Copy link

termski commented Sep 13, 2019

When I copy paste from Windows Notepad three lines with data in towords a Ubuntu in WSL, the copy paste buffer adds an extra carriage return to every line.
look at this printscreen and the hexdump on the file with the copy pasted data and you see the double '0a0a' when it should be a single. (running Windows Terminal (Preview) Version: 0.4.2382.0)
copy-paste

@havidarou
Copy link
Author

This is still happening in 0.5.
From Windows to bash: double jump lines.
From bash to Windows: there are no jump lines every two lines.

@DHowett-MSFT
Copy link
Contributor

/dup #1091

@ghost
Copy link

ghost commented Sep 26, 2019

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Sep 26, 2019
@ghost ghost added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Sep 26, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Interaction Interacting with the vintage console window (as opposed to driving via API or hooks) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests