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 257629

Summary: Wrap after binary (ternary) operator on long line don't work as expected and no way to fix formatting manually
Product: php Reporter: anton0xf <anton0xf>
Component: Formatting & IndentationAssignee: Ondrej Brejla <obrejla>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description anton0xf 2016-01-19 14:01:08 UTC
Summary:
* "Wrapping"/"Binary Operator" = "If Long" doesn't work as expected.
* "Wrapping"/"Wrap After Binary Operator" behave as inverted on existent line break. So user cannot change formatting to right because auto-format will broke it/

Examples:
Suppose "Tabs And Indents"/"Right margin" = 20,
"Wrapping"/"Binary Operators" = "If Long" and "Wrap After Binary Operator" is unchecked.

--- 1 ---
Before ('|' - margin position):
$long_expr == $other|_long_expr;

After:
$long_expr == $other_long_expr;

Expected:
$long_expr 
        == $other_long_expr;

However when "Wrapping"/"Binary Operators" = "Always" it work as expected.

--- 2 ---
Before:
$long_expr 
        == $other_long_expr;

After:
$long_expr == $other_long_expr;

Expected:
$long_expr 
        == $other_long_expr;

However on next code it don't change formatting (remember "Wrapping"/"Wrap After Binary Operator" is unchecked):
$long_expr ==
        $other_long_expr;

And when I set "Wrapping"/"Binary Operators" = "Always" it works as expected.

--- 3 ---
When "Wrapping"/"Wrap After Binary Operator" is checked

Before:
$long_expr == 
        $other_long_expr;

After:
$long_expr == $other_long_expr;

Expected:
$long_expr == 
        $other_long_expr;

However on next code it don't change formatting:
$long_expr
        == $other_long_expr;

--- 4 ---
Same behaviour for ternary operator. 
Before:
$condition ? $long_e|xpr : $other_long_expr;

After:
$condition ? $long_expr
                    : $other_long_expr;

Expected:
$condition 
        ? $long_expr
        : $other_long_expr;

--- 5 ---
Except there are no "Wrap After" option which would prevent next code unchanged.

Before:
$condition 
        ? $long_expr
        : $other_long_expr;

After:
$condition ? $long_expr
                    : $other_long_expr;

Expected:
$condition 
        ? $long_expr
        : $other_long_expr;