question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Temporarily disable auto-indent when pasting multi-line content

See original GitHub issue

It’s just annoying when I receive IndentationError everytime after I pasted some code snippets without modifying the indentation. Is it possible to detect the pasting action and disable auto-indent temporarily?

Also, I think the indent should be automatically shorter in the next line of a return statement.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jamespreedcommented, Feb 2, 2022

This is an issue with prompt-toolkit versions 3.0.20 through 3.0.22. I have tested it on Windows for Python 3.8, 3.9, and 3.10. With IPython 7.27.0, 7.29.0, and 8.0.1. It looks like the issue has been resolved in prompt-toolkit.

Python 3.8 3.9 3.10
prompt-toolkit 3.0.5 OK OK OK
3.0.17 OK OK OK
3.0.18 OK OK OK
3.0.19 OK OK OK
3.0.20 Fail Fail Fail
3.0.21 Fail Fail Fail
3.0.22 Fail Fail Fail
3.0.23 OK OK OK
3.0.24 OK OK OK
3.0.25 OK OK OK
3.0.26 OK OK OK
0reactions
MrMinocommented, Mar 3, 2022

I’m going to close this, basing my decision on @jamespreed research. I haven’t checked this myself, but it seems like it’s not a bug in IPython. If someone thinks otherwise - feel free to reopen / ping me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
vim Tutorial => Disable auto-indent to paste code
When pasting text through a terminal emulator, the auto-indent feature may destroy the indentation of the pasted text. For example:
Read more >
Auto-indent on paste #25260 - microsoft/vscode - GitHub
Steps to Reproduce: 1.Create a file named 'test.php', and type some code like this: image. 2.When I try to paste these selected multiline...
Read more >
How to disable auto-formatting on paste?
Hello.I'm using latest pyCharm 2.6.3If i copy-paste code from one source code file to another, pyCharm seems to apply auto formatting: it...
Read more >
Why does Vim indent pasted code incorrectly?
There're two reasons: Auto insert comment · Auto indenting. For pasting in vim while auto-indent is enabled, you must change to paste mode ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found