Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: AiuaX on April 26, 2012, 03:45:58 am

Title: [RESOLVED] Source Formatter + Indent Options Woes
Post by: AiuaX on April 26, 2012, 03:45:58 am
Though I hope I'm simply overlooking something simple (and please forgive me if I am), I can't help but be stumped by the behavior I'm seeing.

The behavior I'm expecting while writing c++ code in the C::B editor (v 10.05, 32-bit windows 7) is:

The behavior I'm seeing is: When writing c++ code, no indentation is applied to the following structures:

My settings are thus (I'll also include screenshots displaying what I see):

Disabling the source formatter plugin or resetting C::B preferences does not change the behavior.

Am I simply missing a setting somewhere? I could have sworn this used to work. Am I simply crazy?

[attachment deleted by admin]
Title: Re: Source Formatter + Indent Options Woes
Post by: Alpha on April 27, 2012, 03:38:10 am
Disabling the source formatter plugin [...]
This plugin is (I think) unrelated to your problem as it is for on-demand formatting of pre-existing code (Right-click->Format use AStyle).

I am not sure what the problem is, but can you try the following?
Title: Re: Source Formatter + Indent Options Woes
Post by: AiuaX on April 27, 2012, 04:13:25 am
Fascinating!  Switching to CR+LF did indeed restore things to normal.  I think this must have (maybe, possibly, in theory) happened after bringing a version control system into the equation (configured to auto-convert line-endings on checkout to be platform-specific); or maybe I accidentally rolled my mouse wheel over that Settings field - who knows!

Thank you for the suggestion, Alpha!
Title: Re: [RESOLVED] Source Formatter + Indent Options Woes
Post by: Alpha on April 27, 2012, 11:57:22 pm
Patch #3282 (http://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=3282&group_id=5358) submitted to fix this bug.
Title: Re: [RESOLVED] Source Formatter + Indent Options Woes
Post by: oBFusCATed on April 28, 2012, 01:47:02 am
What bug? This looked like a misconfiguration?
Title: Re: [RESOLVED] Source Formatter + Indent Options Woes
Post by: Alpha on April 28, 2012, 02:13:30 am
To reproduce, Settings->Editor... switch "End-of-line mode" to "CR".  Now try typing:
Code
if(true)
{

Normally, this would trigger brace completion such that it becomes (the pipe is the position of the cursor):
Code
if(true)
{
    |
}

However, in "CR" mode, it does not indent:
Code
if(true)
{
|
}