News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

AutoIndent / SmartIndent

Started by surfinbird, October 13, 2007, 10:57:49 PM

Previous topic - Next topic

surfinbird

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?

thomas

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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

surfinbird

Quote from: 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.
I'm not (yet) familiar with the source code of Code::Blocks, any help in that direction would be welcome

thomas

You'll have to look into cbeditor.cpp around lines 2450 and 2488. Remember to put on your peril-sensitive sunglasses.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."