Pasting Still Badly Broken From Windows to Ubuntu: Extra Line Endings and Indents #6865

Closed
opened 2026-01-31 00:49:14 +00:00 by claunia · 4 comments
Owner

Originally created by @FlipperPA on GitHub (Mar 14, 2020).

Environment

Windows build number: 10.0.19041.113
Windows Terminal version (if applicable): 0.9.433.0

Any other software? Ubuntu 18.04, mainly used for Python 3 development.

Steps to reproduce

Create a few lines of code in a text editor, such as Sublime or Notepad, and COPY it:
image

Result of pasting into a Terminal with an ipython shell open:
image
** NOTE THE EXTRA LINE FEEDS AND INDENTATION! **

Result of pasting into a Terminal with vi open:
image
** NOTE THE EXTRA LINE FEEDS AND INDENTATION! **

Result of pasting the same text buffer into PuTTY with an ipython shell open:
image
** It looks perfect! Beautiful! **

Result of pasting the same text buffer into PuTTY with the vi editor open:
image
** It looks perfect! Beautiful! **

The same behavior happens with emacs, pico, vim - not just vi and ipython.

Expected behavior

For the copied buffer to properly paste, like it does in PuTTY, without extra line endings and indents.

Please note that the same text buffer pasted into a PowerShell window works:
image

Actual behavior

See the above screenshots. I end up having to paste code from scratch text editors on Windows into Windows Terminal Preview line-by-line. This gets very old, very fast!

Thanks for your efforts, this is shaping up to be a great product. This is my one, huge, major pain point.

Originally created by @FlipperPA on GitHub (Mar 14, 2020). # Environment ```none Windows build number: 10.0.19041.113 Windows Terminal version (if applicable): 0.9.433.0 Any other software? Ubuntu 18.04, mainly used for Python 3 development. ``` # Steps to reproduce Create a few lines of code in a text editor, such as Sublime or Notepad, and COPY it: ![image](https://user-images.githubusercontent.com/68164/76671215-3a2aa200-656b-11ea-8d6f-e96db5b127e2.png) Result of pasting into a Terminal with an `ipython` shell open: ![image](https://user-images.githubusercontent.com/68164/76671256-73631200-656b-11ea-891f-2ef3baa655e9.png) ** NOTE THE EXTRA LINE FEEDS AND INDENTATION! ** Result of pasting into a Terminal with `vi` open: ![image](https://user-images.githubusercontent.com/68164/76671383-64309400-656c-11ea-9be1-edc28ebc8f69.png) ** NOTE THE EXTRA LINE FEEDS AND INDENTATION! ** Result of pasting the same text buffer into PuTTY with an `ipython` shell open: ![image](https://user-images.githubusercontent.com/68164/76671289-c210ac00-656b-11ea-9ef1-2711847ee0c0.png) ** It looks perfect! Beautiful! ** Result of pasting the same text buffer into PuTTY with the `vi` editor open: ![image](https://user-images.githubusercontent.com/68164/76671413-8a563400-656c-11ea-805f-d685828adaae.png) ** It looks perfect! Beautiful! ** The same behavior happens with `emacs`, `pico`, `vim` - not just `vi` and `ipython`. # Expected behavior For the copied buffer to properly paste, like it does in PuTTY, without extra line endings and indents. Please note that the same text buffer pasted into a PowerShell window works: ![image](https://user-images.githubusercontent.com/68164/76671468-e91bad80-656c-11ea-948a-dffd7b557c89.png) # Actual behavior See the above screenshots. I end up having to paste code from scratch text editors on Windows into Windows Terminal Preview line-by-line. This gets very old, very fast! Thanks for your efforts, this is shaping up to be a great product. This is my one, huge, major pain point.
Author
Owner

@zadjii-msft commented on GitHub (Mar 16, 2020):

You know, I bet this is actually caused by bracketed paste mode. @DHowett-MSFT can probably confirm my suspicion, since he's the expert in that area

@zadjii-msft commented on GitHub (Mar 16, 2020): You know, I bet this is actually caused by bracketed paste mode. @DHowett-MSFT can probably confirm my suspicion, since he's the expert in that area
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 16, 2020):

So, I copied this out of notepad;
image

@DHowett-MSFT commented on GitHub (Mar 16, 2020): So, I copied this out of notepad; ![image](https://user-images.githubusercontent.com/14316954/76784203-77ac4c80-6770-11ea-9002-c837251bf16a.png)
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 16, 2020):

But come to think of it, yes, @zadjii-msft is totally right here. Vi and ipython (probably) request "bracketed paste" mode -- it's a mode that lets the receiving application know that it's receiving a pasted block of text, and it can use that to defer processing the pasted text. Since we don't support it, ipython and vi are immediately processing the pasted text as though the user typed it.

Vim usually uses it to :set paste (which will suppress indentation, among other things).

That'll make this a /dup of #395

@DHowett-MSFT commented on GitHub (Mar 16, 2020): But come to think of it, yes, @zadjii-msft is totally right here. Vi and ipython (probably) request "bracketed paste" mode -- it's a mode that lets the receiving application know that it's receiving a pasted block of text, and it can use that to defer processing the pasted text. Since we don't support it, ipython and vi are immediately processing the pasted text as though the user typed it. Vim usually uses it to `:set paste` (which will suppress indentation, among other things). That'll make this a /dup of #395
Author
Owner

@ghost commented on GitHub (Mar 16, 2020):

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 (Mar 16, 2020): 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#6865