Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: surfinbird on October 13, 2007, 10:57:49 pm

Title: AutoIndent / SmartIndent
Post by: surfinbird on October 13, 2007, 10:57:49 pm
The AutoIndent and/or SmartIndent behaves not as expected when using a code style similar like this:

namespace x
....{
....void func( void )
........{
........if ( test )
............{
............// action
............}
........}
....}

I have checked the "Indent brackets" option in the Source formatter and would expect it to make the difference, but
the AutoIndent and/or SmartIndent generates this:

namespace x
{
....void func( void )
....{
........if ( test )
........{
............// action
........}
....}
}

Is this because the bracket rule doesn't influence a brace, and hence a brace indent option would be needed to make the auto indent working?
Title: Re: AutoIndent / SmartIndent
Post by: thomas on October 15, 2007, 09:24:10 am
The source formatter has nothing to do with the auto indent function. One is a plugin, the other is an editor functionality.
I am not sure if that can be configured differently (never bothered, because I'm fine with ANSI style), but possibly it can... must look in the wxScintilla docu for that. If that is the case, you should be able to change that behaviour by modifying one line of code.
Title: Re: AutoIndent / SmartIndent
Post by: surfinbird on October 15, 2007, 07:03:49 pm
The source formatter has nothing to do with the auto indent function. One is a plugin, the other is an editor functionality.
I am not sure if that can be configured differently (never bothered, because I'm fine with ANSI style), but possibly it can... must look in the wxScintilla docu for that. If that is the case, you should be able to change that behaviour by modifying one line of code.
I'm not (yet) familiar with the source code of Code::Blocks, any help in that direction would be welcome
Title: Re: AutoIndent / SmartIndent
Post by: thomas on January 29, 2008, 02:37:41 pm
You'll have to look into cbeditor.cpp around lines 2450 and 2488. Remember to put on your peril-sensitive sunglasses.