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 567606 - Auto-indentation in Anjuta gets tab indentation wrong for function paramaters
Auto-indentation in Anjuta gets tab indentation wrong for function paramaters
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: language-support-c-cpp-java
unspecified
Other Linux
: Normal major
: ---
Assigned To: Naba Kumar
Anjuta maintainers
Depends on:
Blocks:
 
 
Reported: 2009-01-13 14:46 UTC by Philip Van Hoof
Modified: 2009-02-10 09:18 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Philip Van Hoof 2009-01-13 14:46:14 UTC
Consider this one. I will write a \t as '[tab]', a newline as a '\n' and a space as a dot, '.', to illustrate this bug in a text-only field like this bugzilla's.

This is how Anjuta does auto-indentation right now:

static void\n
my_calling_funcion_wrong (void);\n
[tab]MyItem1 *item1;\n
[tab]MyItem2 *item2;\n
[tab]MyItem3 *item3;\n
\n
[tab]my_long_funcion (item1,\n
[tab][tab][tab][tab]..item2, \n
[tab][tab][tab][tab]..item3);\n
}\n

This is wrong, it should instead do this:

static void\n
my_calling_funcion_right (void);\n
[tab]MyItem1 *item1;\n
[tab]MyItem2 *item2;\n
[tab]MyItem3 *item3;\n
\n
[tab]my_long_funcion (item1, \n
[tab].................item2, \n
[tab].................item3);\n
}\n

The reason for that is compatibility with other people's editor settings for the tab size. For example with _wrong if the original author wrote it with 8-spaces per tab in mind, then another author who has his editor set to use 4-spaces per tab will often see the function as mis-indented. This wouldn't have happened if it was indented the way _right is indented.

I'm not asking to replace all tabs with spaces. That's for strange people who don't get the clue. 

Let's see another example:

static void\n
my_calling_funcion_right (void);\n
[tab]MyItem1 *item1;\n
[tab]MyItem2 *item2;\n
[tab]MyItem3 *item3;\n
\n
[tab]while (TRUE) {\n
[tab][tab]while (TRUE) {\n
[tab][tab][tab]my_long_funcion (item1, \n
[tab][tab][tab].................item2, \n
[tab][tab][tab].................item3); \n
[tab][tab]}\n
[tab]}\n
}\n

Note how easy it becomes to move indentation from more tabs to less tabs without having to worry about 8-space-sized tabs vs. 4-space-sized tabs.
Comment 1 Johannes Schmid 2009-01-13 20:28:42 UTC
Hmm, your are right. Shouldn't be too difficult to fix, at least I hope so.
Comment 2 Johannes Schmid 2009-02-09 21:35:36 UTC
This is fixed in svn now. You can verify this by using View->Editors->White Spaces.

Thanks for reporting.
Comment 3 Philip Van Hoof 2009-02-10 09:18:07 UTC
Great news!