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 257662 - Reformat does not work sometimes
Summary: Reformat does not work sometimes
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-21 13:03 UTC by Rocon
Modified: 2016-02-08 09:17 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 Rocon 2016-01-21 13:03:02 UTC
Product Version = NetBeans IDE 8.1 (Build 201510222201)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.8.0_51
Runtime = Java HotSpot(TM) Client VM 25.51-b03

再现性: 每次都发生

步骤:
当我对一下c++代码格式化时,lambda内的缩进不正确
  inline void Do (int n, void (*f)())
{
        for (int i = 0; i < n; ++i) f();
}

void
renderScene (void)
{
        using namespace D2D::draw;
        Do(5, []
        {
                clear(100, 100, 100);
                clear(100, 100, 100);
                      clear(100, 100, 100);
                clear(100, 100, 100);
        });

}

实际情况:
  缩进不正确:
	clear(100, 100, 100);
  clear(100, 100, 100);
  clear(100, 100, 100);
  clear(100, 100, 100);
	或这样了
	clear(100, 100, 100);
  	clear(100, 100, 100);
 		clear(100, 100, 100);
		clear(100, 100, 100);

预期情况:
  四个clear()函数排列整齐:
	clear(100, 100, 100);
        clear(100, 100, 100);
        clear(100, 100, 100);
        clear(100, 100, 100)
Comment 1 Rocon 2016-01-21 13:10:31 UTC
My Email is 956269867@qq.com
Comment 2 Rocon 2016-01-21 13:12:02 UTC
修改:
当我对一下c++代码格式化时,lambda内的缩进不正确
应为:
当我对以下c++代码格式化时,lambda内的缩进不正确
Comment 3 Jiri Prox 2016-01-21 17:00:44 UTC
Please, describe your problem in English.
Thanks!
Comment 4 soldatov 2016-01-21 17:31:10 UTC
Before reformat:

void
renderScene (void)
{
        using namespace D2D::draw;
        Do(5, []
        {
                clear(100, 100, 100);
                clear(100, 100, 100);
                  clear(100, 100, 100);
                clear(100, 100, 100);
        });

}

After reformat:

void
renderScene(void) {
    using namespace D2D::draw;
    Do(5, [] {
        clear(100, 100, 100);
        clear(100, 100, 100);
                clear(100, 100, 100);
                clear(100, 100, 100);
    });

}
Comment 5 Alexander Simon 2016-01-22 13:37:42 UTC
fixed in enum, change set:
84fbdd5f8b0f
Comment 6 Quality Engineering 2016-01-28 02:34:37 UTC
Integrated into 'main-silver', will be available in build *201601280002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f8ab6f9d453f
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #257662 Reformat does not work sometimes
(transplanted from 84fbdd5f8b0f1dea763537a0fe930b32d8f03c1e)
Comment 7 soldatov 2016-02-01 15:36:43 UTC
My scenario:
- Set Editor > Formatting > C++ > Style = ANSI
- Create C++ Application with main.cpp
- Select C++ standard
- Add such code:
void
renderScene (void)
{
        using namespace D2D::draw;
        Do(5, []
        {
                clear(100, 100, 100);
                clear(100, 100, 100);
                  clear(100, 100, 100);
                clear(100, 100, 100);
        });

}
- Reformat code
===>
void
renderScene(void)
{
    using namespace D2D::draw;
    Do(5, []
    {
        clear(100, 100, 100); // <-- extra space in this line
       clear(100, 100, 100);
       clear(100, 100, 100);
       clear(100, 100, 100);
    });

}
Comment 8 Alexander Simon 2016-02-02 09:25:19 UTC
additional fix in enum:
b4b482617367
Comment 9 ilia 2016-02-04 09:22:45 UTC
  Fixes of this bug:
    http://hg.netbeans.org/releases/rev/b4b482617367
Comment 10 Quality Engineering 2016-02-05 02:38:34 UTC
Integrated into 'main-silver', will be available in build *201602050002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/712995fc04c8
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #257662 Reformat does not work sometimes
- additional fix
(transplanted from b4b4826173674cd1d3a57deb78893f3b830f6c4e)
Comment 11 soldatov 2016-02-05 08:51:50 UTC
Verified in trunk
Comment 12 soldatov 2016-02-08 09:17:44 UTC
Verified in NetBeans 8.1 patch1