This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 20568

Summary: Editor indents curly braces incorrectly after if, for, while
Product: editor Reporter: jmorgan <jmorgan>
Component: LexerAssignee: issues@editor <issues>
Status: RESOLVED WORKSFORME    
Severity: blocker    
Priority: P3    
Version: 3.x   
Hardware: PC   
OS: Windows ME/2000   
Issue Type: DEFECT Exception Reporter:

Description jmorgan 2002-02-14 20:09:56 UTC
Using Netbeans version 3.1.1, build 200202011224, on JDK 1.3.1_02.

I prefer the following placement of curly braces for if, while, etc.:

for ( int i = 0; i < x; i++ )
{
}

When entering one of these statements into Netbeans, after entering an if, for, 
or while statement's first line, I press enter to go to the next line, and it 
indents four spaces (my defined tab-width) past the start of the statement.  
Then:

- In previous versions of Netbeans, I would simply enter a left curly-brace, 
and the editor would jump to the column directly beneath the first character of 
the preceding statement and place the curly-brace there (so that it matched the 
formatting example above).

- In 3.3.1, I enter the curly-brace, and the editor automatically moves the 
cursor one character from the left border of the screen, no matter where the 
first character of the statement in the line before it is, and places the curly-
brace there.  The code then looks like the following:
        if ( int i = 0; i < x; i++ )
 {

How can I make it work the old way?
Comment 1 jmorgan 2002-02-18 20:40:02 UTC
Oops.  Using Netbeans version 3.3.1, not 3.1.1.
Comment 2 Miloslav Metelka 2002-07-09 11:54:30 UTC
This works correctly in recent builds.