Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: nightlight on November 25, 2014, 02:01:26 pm

Title: SmartIndent + Whitesmith formatting
Post by: nightlight on November 25, 2014, 02:01:26 pm
I have used C::B 10.5 until upgrading recently to 13.12 (Windows version). It seems that Smart/AutoIndent & Brace Smart Indent do not cooperate any more with Source Formatting, specifically with the Whitesmith format. This is how the sample is supposed to look like:


Code
int Foo(bool isBar)
  {
  if (isBar)
    {
    bar();
    return 1;
    }
  else
    {
    return 0;
    }
  }

In the old CB, as soon as the open brace was typed at indent +2, the closing brace would be appear right below it, with empty line & cursor ready for the block in between.

In the new version, typing the same way, the code ends up looking like this, as if forcing some other source formatting style:

Code
int Foo(bool isBar)
{
  if (isBar)
  {
     bar();
     return 1;
  }
  else
  {
     return 0;
  }
}

I tried various settings on Smart/AutoIndent, Brace SmartIndent  and Source Formatting, but no luck. Has anyone found how to make SmartIndent & braces work for Whitesmith formatting?
Title: Re: SmartIndent + Whitesmith formatting
Post by: nightlight on April 17, 2016, 02:52:02 pm
The problem still persists in CB version 16.01 -- it just won't do Whitesmith source formatting while you type but only if you manually force reformat command of the file. It's unfortunate I "upgraded" from CB 10.5 which formatted in Whitesmith style as you type just fine.
Title: Re: SmartIndent + Whitesmith formatting
Post by: oBFusCATed on April 17, 2016, 03:16:58 pm
I get a reasonable behavior when I disable the smart indent option in the Settings -> Editor -> General.
Can you describe the problem with more details?