my $level_diff =
$outer_opening->[_LEVEL_] - $rLL->[$Kfirst]->[_LEVEL_];
- if ( !$level_diff || $excess + $rOpts_indent_columns <= 0 ) {
+ if ( !$level_diff || $excess + $rOpts_indent_columns <= 0 )
+ {
$is_one_line_weld = 1;
}
}
# Changed rule from multiple old commas to just one here:
if ( $ibreak >= 0 && $obp_count == 1 && $old_comma_break_count > 0 )
{
- # Do not to break before an opening token because
- # it can lead to "blinkers".
my $ibreakm = $ibreak;
$ibreakm-- if ( $types_to_go[$ibreakm] eq 'b' );
+ if ( $ibreakm >= 0 ) {
- # In order to avoid blinkers we have to be fairly restrictive.
- # This has been updated to avoid breaking at any sequenced item,
- # so now ternary operators are included.
- # (see case b931, which is similar to the above print example)
- ##This works too but is a little more restrictive:
- ##if ( $ibreakm >= 0 && !$type_sequence_to_go[$ibreakm] ) {
- if ( $ibreakm >= 0
- && $types_to_go[$ibreakm] !~ /^[\(\{\[L\?\:]$/ )
- {
- $self->set_forced_breakpoint($ibreak);
+ # In order to avoid blinkers we have to be fairly
+ # restrictive:
+
+ # Rule 1: Do not to break before an opening token
+ # Rule 2: avoid breaking at ternary operators
+ # (see b931, which is similar to the above print example)
+ # Rule 3: Do not break at chain operators to fix case b1119
+ # - The previous test was '$typem !~ /^[\(\{\[L\?\:]$/'
+
+ # These rules can be made even more restrictive in the
+ # future if necessary.
+
+ my $typem = $types_to_go[$ibreakm];
+ if ( !$is_chain_operator{$typem}
+ && !$is_opening_type{$typem} )
+ {
+ $self->set_forced_breakpoint($ibreak);
+ }
}
}
}
=over 4
+=item B<Adjust line break rules for uncontained commas>
+
+Random testing produced case c1119 which was unstable due to the formatting
+rules for breaking lines at commas which occur outside of containers. The
+rules were modified to fix the problem.
+
+20 Apr 2021.
+
=item B<Fix a bad line break choice at a slash>
Random testing produced case c001 in which the following snipppet
request. This should have been done but in this case a flag to prevent this
was not being propagated to later stages of formatting. This has been fixed.
-20 Apr 2021.
+20 Apr 2021, 4fbc69a.
=item B<Fix rare problem with -lp -wn>