5.1.1 : omitted indentation when pasting with the editor
See original GitHub issueInstalled 5.1.1 and reset to factory defaults. Then, I created a small function:
def f():
x = 1
y = 2
I wanted to add another assignment just after x = 1
. So, I copied that entire line and pasted it. This was the result:
def f():
x = 1
x = 1
y = 2
Uninstalled 5.1.1 and installed 5.0.5. Then, I reset to factory defaults and created the same small function:
def f():
x = 1
y = 2
Then, I copied that entire x = 1
line and pasted it. This was the result:
def f():
x = 1
x = 1
y = 2
IMO, the 5.0.5 editor behaved correctly but the 5.1.1 editor neglected to paste in the indentation.
Issue Analytics
- State:
- Created 2 years ago
- Comments:19 (17 by maintainers)
Top Results From Across the Web
Indenting and Turning Off Auto Indent When Pasting Text Into Vi
In this tutorial, we look at indenting and ways to preserve proper indentation when pasting text in the Vi editor. First, we briefly...
Read more >Wrong indentation after copy-paste : PY-18522
We're looking into the problem, but as a temporary workaround you can disable Editor | General | Smart Keys | Smart indent pasted...
Read more >Turning off auto indent when pasting text into vim
To turn off autoindent when you paste code, there's a special "paste" mode. Type :set paste. Then paste your code. Note that the...
Read more >Leading spaces are not preserved when pasting text - TeX
Indent and Unindent Automatically: re-indents text automatically to match the context. ... Go to Options > Configure TeXstudio > Editor.
Read more >Experiencing an odd copy + paste block of code issue with ...
Steps to Reproduce: Copy block of code with indentations correct. Go to new line and indent to where you want the paste code...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@impact27, if the first line a user is trying to paste contains some indentation, I think we should preserve it, and adjust the indentation of all other lines according to that.
What do you think?
I solved this by changing the statements between https://github.com/spyder-ide/spyder/blob/48065f03dc7edb04093425032f9c69f0a26dda25/spyder/plugins/editor/widgets/codeeditor.py#L2836 and (including) https://github.com/spyder-ide/spyder/blob/48065f03dc7edb04093425032f9c69f0a26dda25/spyder/plugins/editor/widgets/codeeditor.py#L2839 to