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

Created on 14 Mar 2020  路  4Comments  路  Source: microsoft/terminal

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.

Area-Input Area-TerminalControl Issue-Bug Product-Conpty Resolution-Duplicate

All 4 comments

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

So, I copied this out of notepad;
image

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

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrmlnc picture mrmlnc  路  3Comments

ghvanderweg picture ghvanderweg  路  3Comments

DieselMeister picture DieselMeister  路  3Comments

NickITGuy picture NickITGuy  路  3Comments

alabuzhev picture alabuzhev  路  3Comments