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

Open
opened 2026-01-31 02:12:59 +00:00 by claunia · 0 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:12:59 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10117