Author Topic: Indenting "case" labels in a "switch" statment  (Read 1593 times)

Offline BenevolentDeity

  • Single posting newcomer
  • *
  • Posts: 2
Indenting "case" labels in a "switch" statment
« on: August 03, 2015, 01:01:58 am »
Hello,

I'm using Windows 8.1 64-bit.  When simply looking through one link after another after a Google search for a "switch" statement, probably 90% of the examples indent the case labels from the column in which the switch keyword itself starts, that is:

switch (something)
{
--->case ...:

However, by default the Code::Blocks editor for some reason follows the minority 10% and does not do this indent.  I've looked at the "General settings" item on the "Configure editor" page and about the only thing that appears to be related is the "Smart indent" checkbox, which is checked by default.  However, unchecking it eliminates all smart indenting, most of which I want to use.  Even though Microsoft's Visual Studio does not by default auto-indent for case labels either (which I find very strange since all of their switch code examples do indent them!), it does provide an option for them to be automatically indented.  I'm sure I'm just missing something in Code::Blocks and I'd appreciate it if someone would point out where I can select that case labels be indented.  I'm not interested in a religious war as to why indenting vs non-indenting is better or more correct but am merely looking for how to change the editor's behavior.

Thanks,
Ray

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12828
    • Travis build status
Re: Indenting "case" labels in a "switch" statment
« Reply #1 on: August 03, 2015, 01:22:47 am »
I think it is hard-coded somewhere in the editor related code.
The code in question will unindent the case statement when the user enters ':'.
Definitely an annoying feature.

If you submit an issue on sf.net I might find some time in the future to fix it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BenevolentDeity

  • Single posting newcomer
  • *
  • Posts: 2
Re: Indenting "case" labels in a "switch" statment
« Reply #2 on: August 03, 2015, 01:34:29 am »
Thanks for the quick response and I'd be glad to submit an issue on sf.net.  However, could you provide me with a little more detail on how to do that?  I see a link in their "Help" category titled "Support Request" and when I click it it takes me to a page titled "SourceForge.net Support", but I don't know what to do at that point.

Regarding the auto-unindenting, I did discover that pressing ctrl+Z after the unindent occurs restores the indent, but ultimately an option to prevent the unindent in the first place would be better.

Thanks,
Ray
« Last Edit: August 03, 2015, 01:36:44 am by BenevolentDeity »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12828
    • Travis build status
Re: Indenting "case" labels in a "switch" statment
« Reply #3 on: August 03, 2015, 08:56:25 am »
This is the place where you should post about this issue https://sourceforge.net/p/codeblocks/tickets/
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]