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 - Wrap after binary (ternary) operator on long line don't work as expected and no way to fix formatting manually
Summary: Wrap after binary (ternary) operator on long line don't work as expected and ...
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-19 14:01 UTC by anton0xf
Modified: 2016-08-29 06:06 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 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;