Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Volatile Pulse on October 16, 2012, 08:38:59 am

Title: Function Auto-Indent
Post by: Volatile Pulse on October 16, 2012, 08:38:59 am
I searched around on the forums this time and even look through a few seemingly relevant posts to no avail. I am a fan of attached braces for functions and control statements. Now, I'm not positive, but I believe what I want falls under the Auto-Indent title, and I hope this is the right forum, forgive me if not.

Typically when I am typing up some code in C::B, I really enjoy the way it auto-indents the cursor and moves the ending brace to the next line like so:
From:
Code
for (int i = 0; i < length; i ++) {|}
To:
Code
for (int i = 0; i < length; i ++) {
   |
}

But when I attempt to do this with function definitions, the auto-indent behaves differently (possibly because the definitions aren't previously indented?):
From:
Code
int main() {|}
To:
Code
int main() {
|}

I used the | symbol to symbolize where the cursor is located before/after pressing enter. I have just tried this in the latest C::B Nightly (8455) on Windows XP and still behaves the same. If any more information is needed, please ask.
Title: Re: Function Auto-Indent
Post by: carra on October 16, 2012, 09:50:06 am
But when I attempt to do this with function definitions, the auto-indent behaves differently (possibly because the definitions aren't previously indented?):
I have seen something that could be related to this. In C::B, when you select several lines of code and press TAB key to indent them, empty lines are not indented. I personally find it annoying, because when you attempt to write in one of those lines you will inadvertedly write an unindented line within indented blocks.