Copy and paste in bash generates one single line #3252

Closed
opened 2026-01-30 23:16:55 +00:00 by claunia · 17 comments
Owner

Originally created by @havidarou on GitHub (Aug 7, 2019).

Originally assigned to: @carlos-zamora on GitHub.

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.

Originally created by @havidarou on GitHub (Aug 7, 2019). Originally assigned to: @carlos-zamora on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none 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 <!-- A description of how to trigger this bug. --> Copy several text lines and paste them using vi text editor in bash (WSL). # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> Properly copied lines within the text editor. # Actual behavior <!-- What's actually happening? --> A single line is generated with spaces so that it looks like they are different lines.
claunia added the Issue-BugArea-InteractionResolution-DuplicateProduct-Terminal labels 2026-01-30 23:16:56 +00:00
Author
Owner

@havidarou commented on GitHub (Aug 7, 2019):

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.

@havidarou commented on GitHub (Aug 7, 2019): 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.
Author
Owner

@carlos-zamora commented on GitHub (Aug 7, 2019):

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 commented on GitHub (Aug 7, 2019): 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!
Author
Owner

@havidarou commented on GitHub (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).

@havidarou commented on GitHub (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).
Author
Owner

@johanburati commented on GitHub (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

@johanburati commented on GitHub (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](https://user-images.githubusercontent.com/106444/62755050-63eb8a00-baad-11e9-9512-4a4ca050eb38.png)
Author
Owner

@jonneolie commented on GitHub (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.

@jonneolie commented on GitHub (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.
Author
Owner

@havidarou commented on GitHub (Aug 14, 2019):

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.
@havidarou commented on GitHub (Aug 14, 2019): 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.
Author
Owner

@polyisobutylene commented on GitHub (Aug 15, 2019):

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

@polyisobutylene commented on GitHub (Aug 15, 2019): 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](https://user-images.githubusercontent.com/1903878/63097615-ee653b00-bf3e-11e9-893f-a02110319506.png) Copying out of the terminal into a text editor does not add proper newlines as expected ![image](https://user-images.githubusercontent.com/1903878/63097675-15bc0800-bf3f-11e9-9e0f-4d744312024e.png) 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](https://user-images.githubusercontent.com/1903878/63097776-43a14c80-bf3f-11e9-852e-5b367b32c062.png)
Author
Owner

@ghost commented on GitHub (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

@ghost commented on GitHub (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
Author
Owner

@aebian commented on GitHub (Aug 19, 2019):

Can confirm this behaviour.

@aebian commented on GitHub (Aug 19, 2019): Can confirm this behaviour.
Author
Owner

@hteibler commented on GitHub (Aug 26, 2019):

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

@hteibler commented on GitHub (Aug 26, 2019): If you paste the output of a table ( with \t and \n ) ![image](https://user-images.githubusercontent.com/24313736/63688683-56056b00-c808-11e9-97b9-64e6c395b0e1.png) in LibreOffice all \t and \n are replaced with spaces ??? ![image](https://user-images.githubusercontent.com/24313736/63688721-6d445880-c808-11e9-916c-4b560eae462b.png)
Author
Owner

@ccarv commented on GitHub (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.

@ccarv commented on GitHub (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.
Author
Owner

@genio commented on GitHub (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.

@genio commented on GitHub (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.
Author
Owner

@nitinyadav745 commented on GitHub (Sep 13, 2019):

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.

@nitinyadav745 commented on GitHub (Sep 13, 2019): 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.
Author
Owner

@termski commented on GitHub (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

@termski commented on GitHub (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](https://user-images.githubusercontent.com/55285077/64867544-d962f100-d63d-11e9-919f-983a4eff3529.PNG)
Author
Owner

@havidarou commented on GitHub (Sep 25, 2019):

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.

@havidarou commented on GitHub (Sep 25, 2019): 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.
Author
Owner

@DHowett-MSFT commented on GitHub (Sep 26, 2019):

/dup #1091

@DHowett-MSFT commented on GitHub (Sep 26, 2019): /dup #1091
Author
Owner

@ghost commented on GitHub (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 commented on GitHub (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!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3252