Community
Participate
Working Groups
Build ID: 20090619-0625 Steps To Reproduce: 1. Window | Preferences | General | Editors | Text Editors: Set "Displayed tab width" to 2, enable "Insert spaces for tabs". 2. Windows | Preferences | C/C++ | Code Style | Edit...: Set "Tab policy" to "Spaces only", "Indentation size" to 2, "Tab size" to 2. 3. Create new C project, add C source file. 4. Begin a "struct", e.g., struct foo { [enter] 5. Eclipse completes struct block, but puts cursor inside block indented 4 spaces instead of 2. 6. Also affects union, enum, class definitions. More information: Does not happen with function declarations, if/for/while statements, etc.
I assume you have also enabled the option to indent 'public', 'protected', 'private' within class bodys. Otherwise I cannot reproduce the behavior you describe.
Indeed, this does solve the issue: 1. Windows | Preferences | C/C++ | Code Style | Edit... 2. Indentation tab, Indent group. 3. Uncheck "'public', 'protected', 'private' within class body". Thank you for that tip. However, this Indent option certain looks like it should only apply to class Foo { } blocks. It is also affecting [typedef] struct { } enum { } union { } Can you reproduce that behavior? Those structures should have an option or options of their own.
(In reply to comment #2) > Can you reproduce that behavior? Those structures should have an option or > options of their own. Yes, I can reproduce. The indenter does not differentiate between class and non-class structures. I'll leave this bug open for that reason.
Note that in C++, structs can have access specifiers just like classes.
Created attachment 270730 [details] tab width in arrays is also wrong