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 177481 - [indentation] Brace indentation is bad at the beginning of new line
Summary: [indentation] Brace indentation is bad at the beginning of new line
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: PC Windows 7 x64
: P2 normal with 2 votes (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-24 00:44 UTC by 007pig
Modified: 2010-02-08 07:16 UTC (History)
0 users

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 007pig 2009-11-24 00:44:40 UTC
I'd like to input code in this format:

function foo($bar)
{
    // code here
}

After I input function foo($bar) and press Enter, the cursor is indented:

function foo($bar)
<TAB>(Cursor here)

I think it's ok. However, when I type the first brace {, I expect the editor to remove <TAB>. In fact it doesn't:

function foo($bar)
<TAB>{

<TAB>}

The correct output should be
function foo($bar)
{

}
Comment 1 Filip Zamboj 2009-11-24 00:52:06 UTC
I guess that behavior is correct ... However, I let the developer to evaluate.  

@reporter: we are missing your build number. Thanks.
Comment 2 007pig 2009-11-24 00:52:30 UTC
Sorry I double checked and function doesn't have such problem.
However, if, for, foreach, while, do have such issue.
Comment 3 007pig 2009-11-24 00:53:21 UTC
My version is 6.8 Beta.
Comment 4 Petr Pisl 2009-11-24 03:11:02 UTC
You are right. The behavior should be more clever and when a user write { it should remove the tabs as you expect. Is too late to fix it for nb 6.8. I will fix it for the next release.
Comment 5 artur_m 2010-01-15 05:35:49 UTC
similar bug in 6.8:

if(1)
    {

expected:

if(1)
{
Comment 6 gdebug 2010-01-26 09:11:12 UTC
I can confirm this on Product Version: NetBeans IDE 6.8 (Build 200912041610). If i remember correctly, this bug was not present in 6.7.
Comment 7 Petr Pisl 2010-02-08 07:16:36 UTC
Fixed by recent changes in the indentation engine. Works in NetBeans 6.9 builds.