Sublime Forum

Wrong TAB size on new line (Python)

#1

Hi, when working on a class definition on Python it happens that a doing will jump 8 spaces instead of 4.
In the attached pic you can see that the bad jump is in RED, the one happening now. The green should be the right jump.
When working with functions, it works ok, the problem is in class definitions.

Any clue why?

http://img6.imagebanana.com/img/57d3p1tn/Selection_128.png

0 Likes

#2

Bump

0 Likes

#3

This is Sublime Text trying to guess where you want the cursor. The editor thinks you still want to be in the function. You can turn this off by adding [pre=#2A2A2A]“smart_indent”: true[/pre]
to Preferences: Settings - User.

There is also ‘auto_indent.’ I don’t know which one is actually responsible for your dilemma so you try and figure it out (I personally like this behavior).

0 Likes

#4

[quote=“C0D312”]This is Sublime Text trying to guess where you want the cursor. The editor thinks you still want to be in the function. You can turn this off by adding [pre=#2A2A2A]“smart_indent”: true[/pre]
to Preferences: Settings - User.

There is also ‘auto_indent.’ I don’t know which one is actually responsible for your dilemma so you try and figure it out (I personally like this behavior).[/quote]

I think I tried that… but see this vid, http://youtu.be/DyCW36CTwKc is kind of annoying. Let you know.

0 Likes

#5

"smart_indent": true doesn’t do the trick… I remember now that I tried all combinations… IMHO ST2 should do 1 level down if there are at least 2 blank lines… that will fix it.

If it’s using python code to do that I may take a look to see if I can tweak it, but I don’t know where to look.

0 Likes

#6

Hmm… you behavior seems different than mine. Perhaps is from a plugin?

Anyway, try settings auto_indent to false. That disables this indentation for me. If that doesn’t change anything, it’s most likely a plugin.

0 Likes

#7

[quote=“C0D312”]Hmm… you behavior seems different than mine. Perhaps is from a plugin?

Anyway, try settings auto_indent to false. That disables this indentation for me. If that doesn’t change anything, it’s most likely a plugin.[/quote]

Yes that does it, but I want auto_indent on :frowning:

I think is a bug in either smart_indent or auto_indent, if it could detect that after 2 blank lines I don’t want to be working inside the previous method but start a new one, that will do it.

Thanks

0 Likes