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 183666 - Autoindent after typing braces is not respected
Summary: Autoindent after typing braces is not respected
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
: 147612 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-07 16:51 UTC by ajck
Modified: 2010-05-19 06:06 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ajck 2010-04-07 16:51:15 UTC
When you press Enter to go to new line after typing an opening brace, caret is indented as you need, but then, after you type a brace, the indent is removed. If you go to Tools>Options>Editor>Formatting and if you choose "Java" for Language, "Braces" from the cathegory combo and then "Braces Placement", you can set "New Line Indented" for "Other". However, this setting is not correctly respected when you type the code manually.

Example - editor should allow:

if(a == 1)
[single tab here]{
[single tab here]<some code...>
[single tab here]}

So, after typing the 'if' line and hitting return, editor auto-indents by a
single tab but then upon hitting the '{' it
immediately removes the tab, so the brace is aligned under the 'i' of 'if'.

THIS WAS REPORTED 20 MONTHS AGO AND IS STILL NOT FIXED!!
Comment 1 Vitezslav Stejskal 2010-04-08 05:58:24 UTC
(In reply to comment #0)
> THIS WAS REPORTED 20 MONTHS AGO AND IS STILL NOT FIXED!!

So, where is the original report? Hove you got its number? Thanks
Comment 2 ajck 2010-04-09 15:03:04 UTC
http://netbeans.org/bugzilla/show_bug.cgi?id=150228 which was marked as duplicate of http://netbeans.org/bugzilla/show_bug.cgi?id=147612

This is not resolved after 20 months. When you type the following (for example) or any other statement requiring {}:

while(a == 1)

and hit return, the editor autoindents as it should:

while(a == 1)
[indent here]<-- cursor is now here

then you hit opening brace {
and the editor moves the brace and cursor back to underneath the while, like this:

while(a == 1)
{

This is really frustrating and is not how I write code. It is also ignoring the settings in the Editor prefs. If you know a way round this I would be most grateful to hear it!

Thanks,
Alex
Comment 3 Vitezslav Stejskal 2010-04-10 04:28:08 UTC
Well, I understand that this is frustrating and we are sorry about not being able to fix this for so long. The problem is that the java editor uses the advanced formatter only for formatting (eg. all the formatting settings from Tools-Options are applied only when formatting), but not for indenting. When indenting the editor still uses the old simple indenter. This is a long time overdue task to rewrite the java editor indentation and use the new settings. Unfortunately, it's not an easy task and the focus in the recent releases has been elsewhere.
Comment 4 Vitezslav Stejskal 2010-04-10 04:28:34 UTC
*** Bug 147612 has been marked as a duplicate of this bug. ***
Comment 5 Dusan Balek 2010-05-13 09:52:27 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/571021c3261d
Comment 6 Quality Engineering 2010-05-17 15:26:52 UTC
Integrated into 'main-golden', will be available in build *201005170932* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:
Comment 7 Quality Engineering 2010-05-19 06:06:29 UTC
Integrated into 'main-golden', will be available in build *201005182201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log: