After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 662956 - Wrong indention of blocks (braces and contents) after labels
Wrong indention of blocks (braces and contents) after labels
Status: RESOLVED OBSOLETE
Product: anjuta
Classification: Applications
Component: plugins: language-support-c-cpp-java
git master
Other All
: Normal normal
: ---
Assigned To: Naba Kumar
Anjuta maintainers
Depends on:
Blocks:
 
 
Reported: 2011-10-28 17:42 UTC by Arnel Borja
Modified: 2020-11-06 20:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Arnel Borja 2011-10-28 17:42:41 UTC
Autoindent do not indent braces and its contents after labels.

Example:
void
helloworld (int english, int japanese)
{
	if (english)
	{
		printf ("Hello World!");
	}

	nippon_go:
		if (japanese)
	{
		printf ("Kon'nichiwa Sekai!");
	}
}
Comment 1 Johannes Schmid 2011-10-28 19:34:11 UTC
This case is really difficult to catch without a full parser because of the switch() statement:

switch(test)
{
  case 1:
    do_something();
  (...)
}

In this case, you want indentation. In general the style for labels is to put them in the first level, so the whole things would look like that and that should be fine:

void
helloworld (int english, int japanese)
{
    if (english)
    {
        printf ("Hello World!");
    }

nippon_go:
    if (japanese)
    {
        printf ("Kon'nichiwa Sekai!");
    }
}
Comment 2 Arnel Borja 2011-10-29 08:10:28 UTC
What if it's like this:

Check if label is a case in a switch (have "case" before it).
Make labels indent like preprocessor directives (always in first level).

Is it possible?
Comment 3 Johannes Schmid 2011-10-29 09:26:15 UTC
Sure it's possible but the indentation code is not entirely easy and it is kind of hard to add more special cases. Also consider the "labels" inside classes (public:, private:, protected:) that would need another special case.

Patches of course welcome ;)
Comment 4 Arnel Borja 2011-11-17 04:30:43 UTC
I only wanted to add that even inside switch blocks, if's and other blocks have wrong indentation.
Comment 5 André Klapper 2020-11-06 20:22:49 UTC
bugzilla.gnome.org is being replaced by gitlab.gnome.org. We are closing all old bug reports in Bugzilla which have not seen updates for many years.

If you can still reproduce this issue in a currently supported version of GNOME (currently that would be 3.38), then please feel free to report it at https://gitlab.gnome.org/GNOME/anjuta/-/issues/

Thank you for reporting this issue and we are sorry it could not be fixed.