# The combination -wn -lp -dws -naws does not work well and can
# cause blinkers. See case b1020. It will probably only occur
# in stress testing. For this situation we will only weld if we
- # start at a 'good' location.
+ # start at a 'good' location. Added 'if' to fix case b1032.
if ( $ci_level
&& $rOpts_line_up_parentheses
&& $rOpts_delete_old_whitespace
&& !$rOpts_add_whitespace )
{
- my $type_first = $rLL->[$Kfirst]->[_TYPE_];
- my $type_prev = $rLL->[$Kprev]->[_TYPE_];
- unless ( $type_prev =~ /^[=\,\.\{\[\(\L]/
- || $type_first =~ /^[=\,\.\{\[\(\L]/ )
+ my $type_first = $rLL->[$Kfirst]->[_TYPE_];
+ my $type_prev = $rLL->[$Kprev]->[_TYPE_];
+ my $token_first = $rLL->[$Kfirst]->[_TOKEN_];
+ unless (
+ $type_prev =~ /^[=\,\.\{\[\(\L]/
+ || $type_first =~ /^[=\,\.\{\[\(\L]/
+ || $type_first eq '||'
+ || ( $type_first eq 'k' && $token_first eq 'if'
+ || $token_first eq 'or' )
+ )
{
+ if (DEBUG_WELD) {
+ $Msg .=
+"Skipping weld: poor break with -lp and ci at type_first='$type_first' type_prev='$type_prev'\n";
+ print $Msg;
+ }
next;
}
}
my $rLL = $self->[_rLL_];
return unless ( defined($rLL) && @{$rLL} );
+ my $ris_list_by_seqno = $self->[_ris_list_by_seqno_];
my $ris_seqno_controlling_ci = $self->[_ris_seqno_controlling_ci_];
my $rseqno_controlling_my_ci = $self->[_rseqno_controlling_my_ci_];
my $rlines = $self->[_rlines_];
# Fix all tokens up to the next sequence item if we are changing CI
if ($seqno_top) {
- my $space = $available_space{$seqno_top};
- my $length = $rLL->[$KLAST]->[_CUMULATIVE_LENGTH_];
- my $count = 0;
+ my $is_list = $ris_list_by_seqno->{$seqno_top};
+ my $space = $available_space{$seqno_top};
+ my $length = $rLL->[$KLAST]->[_CUMULATIVE_LENGTH_];
+ my $count = 0;
for ( my $Kt = $KLAST + 1 ; $Kt < $KNEXT ; $Kt++ ) {
- # but do not include tokens which might exceed the line length
+ # But do not include tokens which might exceed the line length
+ # and are not in a list.
# ... This fixes case b1031
my $length_before = $length;
$length = $rLL->[$Kt]->[_CUMULATIVE_LENGTH_];
if (
!$rLL->[$Kt]->[_CI_LEVEL_]
- && ( $length - $length_before < $space
+ && ( $is_list
+ || $length - $length_before < $space
|| $rLL->[$Kt]->[_TYPE_] eq '#' )
)
{
=over 4
+=item B<Fix rare problem with combination -lp -wn -naws>
+
+This update fixes case b1032 by includeing lines starting with 'if', 'or', and
+|| among the stable breakpoints for welding when -lp -naws flags are also
+set.
+
+This update also modifies update 7a6be43 of 16 Mar 2021 to exclude list items
+when checking token lengths. This reduces changes to existing formatting
+while still fixing the problem in case b1031.
+
+18 Mar 2021.
+
=item B<Fix definition of list within list for -bbx flags>
Testing produced a blinking state involving a -bbx=2 flag with an unusual
list containg another list being too restrictive. This update fixes case
1024.
-17 Mar 2021.
+17 Mar 2021, 7f5da0a.
=item B<Fix problem with -xci and long tokens>