Sublime Forum

Auto-indent and '#'

#1

Hi,

I’m using build 2217 on Windows. Generally the editor is really cool, but there is one little pain with auto-indent. When writing any C preprocessor stuff (e.g. several #include statements), the auto-indent on next line is indented by one char. Obviously it is triggered with ‘#’ on beginning of line.

I was able to suppress it only with complete disabling of the auto-indent:

"auto_indent": false

For me, the most natural way is trivial auto-indent, when ENTER simply copies indentation of the previous line (regardless of all brackets, tags etc.) Can this be set somehow?

Any help would be appreciated.

Regards,
Mity

0 Likes

Bugs with auto-indent
#2

Do you have a small code example for us?
I just tried it and I can’t reproduce it on Windows Vista, build 2217 (and I have auto-indent enabled).

0 Likes

#3

Strange, tried with new file and it does not happen. I can reproduce this way:

(1) Create new doc (Ctrl+N).
(2) Paste in this source (Ctrl+V): mctrl.git.sourceforge.net/git/gi … .c;hb=HEAD
(3) Switch syntax highlight to C language.
(4) Place cursor on the end of line 19 or 20 and press enter. Voila.

0 Likes

#4

I found the issue!
It’s actually the comments block at the top of the page that causes this. You can test it out by creating a new file, set syntax to C (or C++, same happens there) and do your includes: no problem.
Then add a comment block at the start and after that you’ll see that a new line will get indented.

I believe this is a bug in Sublime Text2, so it’s best to report it with a full description of how to reproduce it.

0 Likes