Identation Issues When copy/pasting multiline statements into ipython or python shell #10119

Closed
opened 2026-01-31 02:13:01 +00:00 by claunia · 4 comments
Owner

Originally created by @hcoura on GitHub (Aug 12, 2020).

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.388]
Windows Terminal version (if applicable): Windows Terminal Preview Version: 1.2.2022.0
WSL 2 Ubuntu 20.04
Python 3.7.8
ipython 7.17.0

Steps to reproduce

Copy some python code like:

v = 1
a = 2
c = 3

def abc():
    a = 1
    b = 2

And paste into ipython (python shell shows a similar behavior but it's harder to show the issue)

Expected behavior

This is what I would get if doing the same in a ubuntu installation

In [1]: v = 1
   ...: a = 2
   ...: c = 3
   ...:
   ...: def abc():
   ...:    a = 1
   ...:    b = 2

Actual behavior

In [3]: v = 1

In [4]: a = 2

In [5]: c = 3

In [6]:

In [6]: def abc():
   ...:         a = 1
   ...:             b = 2

Each statement goes to a separate line (which gets ran), and the sttm within the function are wrongly indented.
I guess both share the same cause.

Now I don't know if this is a Windows Terminal bug per se or something on the python side of things, since if I do the same and paste into vim, the indentation is fine.

Originally created by @hcoura on GitHub (Aug 12, 2020). # Environment ```none Windows build number: Microsoft Windows [Version 10.0.19041.388] Windows Terminal version (if applicable): Windows Terminal Preview Version: 1.2.2022.0 WSL 2 Ubuntu 20.04 Python 3.7.8 ipython 7.17.0 ``` # Steps to reproduce Copy some python code like: ``` v = 1 a = 2 c = 3 def abc(): a = 1 b = 2 ``` And paste into ipython (python shell shows a similar behavior but it's harder to show the issue) # Expected behavior This is what I would get if doing the same in a ubuntu installation ``` In [1]: v = 1 ...: a = 2 ...: c = 3 ...: ...: def abc(): ...: a = 1 ...: b = 2 ``` # Actual behavior ``` In [3]: v = 1 In [4]: a = 2 In [5]: c = 3 In [6]: In [6]: def abc(): ...: a = 1 ...: b = 2 ``` Each statement goes to a separate line (which gets ran), and the sttm within the function are wrongly indented. I guess both share the same cause. Now I don't know if this is a Windows Terminal bug per se or something on the python side of things, since if I do the same and paste into vim, the indentation is fine.
claunia added the Resolution-Duplicate label 2026-01-31 02:13:01 +00:00
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Aug 12, 2020):

Related: https://github.com/microsoft/Terminal/issues/395#issuecomment-602254180

@KalleOlaviNiemitalo commented on GitHub (Aug 12, 2020): Related: <https://github.com/microsoft/Terminal/issues/395#issuecomment-602254180>
Author
Owner

@DHowett commented on GitHub (Aug 13, 2020):

This is definitely a /dup of #395. There's a special input mode that lets an application know when text is being pasted so it can do special things like showing you all the commands before they're committed.

@DHowett commented on GitHub (Aug 13, 2020): This is definitely a /dup of #395. There's a special input mode that lets an application know when text is being _pasted_ so it can do special things like showing you all the commands before they're committed.
Author
Owner

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

@developer992 commented on GitHub (Oct 9, 2025):

so how do i fix this ?

@developer992 commented on GitHub (Oct 9, 2025): so how do i fix this ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10119