Sublime Forum

Tab keypress bug?

#1

Hello, sometimes when i press tab key (even if in settings i have “tab_size”: 4, ) it will indent with only 2 spaces.
Anybody else has this problem?

I`m on Windows 7 x64 using dev 2097

0 Likes

#2

When you press tab with translate_tabs_to_spaces on, it won’t always insert tab_size spaces, it’ll insert enough spaces to take you to the next tabstop (i.e., the next column that’s a multiple of tab_size), which will insert between 1-tab_size spaces

0 Likes

#3

Sorry, i didn`t understand you. Why in some cases when i press tab it will insert 4 space ( = tab with size 4) and in other cases… only 2 ( = tab with size 2). :smile:
In user settings i have

	"translate_tabs_to_spaces":false,
	"tab_size": 4

http://screencast.com/t/ZJz17h9gyPr

see that please

0 Likes

#4

That’s working as it should - tab indents up to the next tab stop.

0 Likes

#5

I think I’m seeing the same problem…

I’ve got tab_size set to 3 (and translate_tabs_to_spaces: true in my case), but repeatedly pressing tab will only indent by 2 spaces each time.

(Using “.” to represent a space)

...foo bar
Repeatedly pressing “tab” with the cursor just before “bar”:

[code]…foo
…bar

…bar

…bar
etc.[/code]

For me, it seems that the tabstops are always at multiples of 2.

Thanks,
Mike

0 Likes

#6

Check the indentation settings that are applied to the current file, via the View/Indentation menu - it sounds like the automatic indentation detection is setting the tab_size to 2 for you. You can disable it via setting the detect_indentation setting to false.

0 Likes

#7

Brilliant! Yes, that was exactly it.

It still amazes me how much there is to this editor I’ve yet to discover!

Many thanks,
Mike

0 Likes