Stream: helpdesk (published)

Topic: Extra identations in REPL


view this post on Zulip Kwaku Oskin (Aug 06 2021 at 14:22):

I took a look at 1.8 (somewhat outdated, I presume), and there is a new feature in REPL: each time I paste strings, it adds additional indentation. So this ends up rather ugly.

flameshot-2021-08-06T17-21-12.png

Does anyone know, when and where exactly it was introduced?

view this post on Zulip Mosè Giordano (Aug 06 2021 at 21:35):

Does that happen consistently? I've seen a similarly weird behaviour from time to time in stable versions, but it doesn't bother me too much because it's fairly rare

view this post on Zulip Kwaku Oskin (Aug 06 2021 at 22:04):

It just happened and then disappeared again.
Very strange, I do not really know what is going.

view this post on Zulip Rafael Fourquet (Aug 07 2021 at 06:58):

This probably comes from the "auto-indent" feature of the REPL (set in Base.active_repl.options.auto_indent). When you press enter, the next line is indented like the current one. Then, when you paste some code, this should be disabled (the REPL normally recognizes that you are pasting, so auto-indent is temporarily disabled). But in some circumstances (I don't remember when, maybe with some Windows shell?), this is not recognized, so each new line of the pasted code, presumably already indented, gets more spaces added in front because of auto-indentation.

view this post on Zulip Kwaku Oskin (Aug 07 2021 at 07:22):

Yep, that's what I thought as well.

It was not a windows shell, though, it was paste in neovim terminal.

But at the moment when I have figured out how to turn auto indentation off, this effect disappeared. Pure magic :-)

view this post on Zulip Sebastian Pfitzner (Aug 07 2021 at 08:15):

Probably an issue with bracketed pasting; some terminals (notably Windows' cmd) don't support it, so you get auto indentation because it looks like someone is just typing code to the REPL.

view this post on Zulip Kwaku Oskin (Aug 07 2021 at 11:01):

It was neovim terminal, not windows.

Now I know the cure, but I wonder, why it appear and disappear again \_(%)_/


Last updated: Nov 06 2024 at 04:40 UTC