Code::Blocks Indentation Issue

Hi guys I use the Code::Blocks IDE for C++ programming.
I am pretty new to Code::Blocks but like it a lot.

Except that when I use for statements it does not auto-indent correctly.

I type in this:
1
2
3
4
5
6
7
int main()
{
    for (int x{0}; x < 1000000000; x++)
    {

    }
}

BUT Code::Blocks auto-indents it like this:
1
2
3
4
5
6
7
int main()
{
    for (int x{0}; x < 1000000000; x++)
        {

        }
}

and now even the indents outside the for statement lines up with those braces. I don't want to click the source code formatter every time I use the for statement like down below:
1
2
3
4
5
6
7
8
int main()
{
    for (int x{0}; x < 1000000000; x++)
        {

        }
        return 0; // Now return 0; is lined up with the braces above
}


Anyone know how to change this in the settings?
Last edited on
You may want to disable the "Smart Indent" feature, but you have to indent your code manually.
@SakurasouBusters

I already tried combination of turning off and on the "Auto Indent" and "Smart Indent" features but it 's the best with both on.

Except for that darn for statement indent.

Got any ideas?
Last edited on
Take a look at

Settings -> Editor... -> Source formatter
@coder777

Yes, but even if I change those settings won't I have to press Plugins -> Source Code Formatter every time I use the for statement?
Topic archived. No new replies allowed.