Sublime Forum

[SOLVED] Problem with indentation

#1

Hi,
I have a problew with automatic indentation after a doxygen commentary which is on the following model :

/*
' '*
' '*/

After this commentary, indentation of 1 space is not reset as you can see on the following picture :
http://data.imagup.com/12/1175452994.png

There is a reset when there is no space at the beginning of the lines of the commentary :
http://data.imagup.com/12/1175453024.png

On the two previous pictures, I used reindent on the whole source code.
I tried to modify the config file containing regalur expressions without success…
The problem is present (at least) with C et C++ files.

If someone has a idea to help me :smile:

0 Likes

#2

It seems that when the string “/*” is recognized, indentations rules are not called.

When I add the following regular expression to the file Indentation Rule (for c++) :

| 	   ^ \s* \*\n .* $

I can decrease the indentation after recognition of “*n”
But if I changed the previous rule to

| 	   ^ \s* \*/ .* $

the string “*/” does not receive any handling…

0 Likes

#3

I think that if I find how to desactive auto alignment at the same level with spaces when I press Enter, my problem could be solved… :cry:

In fact, I only need auto tab, but I want to do spaces by myself if necessary

0 Likes

#4

Finaly, I found a solution by retesting my previous attempts…
I replaced \s by . and it works !
It seems that spaces are not recognized by the regular expression \s*.

If someone has the same problem than me, my solution is the following :
Preferences -> Browse Packages -> C++ -> Indentation Rules.tmPreferences
then add ^ .* \*/ .* $ to decreaseIndentPattern.

The first rule ^ (.*\*/)? \s* \} .* $ was not sufficent cause a bracket was expected :geek:

0 Likes