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 177229 - Indent problem with multiple loops or if conditions
Summary: Indent problem with multiple loops or if conditions
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All Linux
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-19 11:03 UTC by TheDestroyer
Modified: 2010-01-26 06:51 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 TheDestroyer 2009-11-19 11:03:41 UTC
Dear Sir,

The problem is very simple, it happens when I, for example, create a loop or if condition without braces. The compiler reads the next line as the loop content or the if condition content, and uses the next second next line as it's not included in the loop or the if condition, for example:

for(i=0;i<10;i++)
   cout<<"i="<<i<<endl;
cout<<"Hello"<<endl;

In this code, the compiler posts only the i value for 10 times, which of course changes during the loop, and the "Hello" message only once, considering it not in the loop.

The problem in your program, is that when I do this, with 3 loops, the second next line after the loop keeps another indent, for example:

for(i=0;i<10;i++)
   for(j=0;j<10;j++)
      for(k=0;k<10;k++)
      {
         //contents of the last loop
      }
      //the next line starts from here, while it should take no indents at all.


I hope you check this and fix it.

Thank you,
Sincerely,
Samer
Comment 1 Jiri Prox 2009-11-20 02:55:44 UTC
In Java this works as expected, reassigning to cnd for evaluation
Comment 2 Alexander Simon 2010-01-09 04:09:21 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/59491104ac67
Comment 3 Quality Engineering 2010-01-09 23:40:28 UTC
Integrated into 'main-golden', will be available in build *201001100200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/59491104ac67
User: alexvsimon@netbeans.org
Log: fixed BZ#177229 Indent problem with multiple loops or if conditions
Comment 4 Alexander Pepin 2010-01-15 07:12:06 UTC
verified in trunk build 201001150201
Comment 5 pgebauer 2010-01-18 05:55:20 UTC
The fix has been ported into the release68_fixes repository.
http://hg.netbeans.org/release68_fixes/rev/0de0b7a0814b
Comment 6 Alexander Pepin 2010-01-26 06:51:41 UTC
verified in patch1 candidate