n=1 stable: break at all commas after => if container is open,
EXCEPT FOR one-line containers
n=2 break at all commas after =>, BUT try to form the maximum
- maximum one-line container lengths
+ one-line container lengths
n=3 do not treat commas after => specially at all
n=4 break everything: like n=0 but ALSO break a short container with
a => not followed by a comma when -vt=0 is used
# these arrays must retain values between calls
my ( @has_broken_sublist, @dont_align, @want_comma_break );
+ my $length_tol;
+
sub initialize_scan_list {
@dont_align = ();
@has_broken_sublist = ();
@want_comma_break = ();
+
+ # Use an increased line length tolerance when -ci > -i
+ # to avoid blinking states (case b923 and others).
+ $length_tol =
+ 1 + max( 0, $rOpts_continuation_indentation - $rOpts_indent_columns );
+
return;
}
my $i_opening_minus =
$self->find_token_starting_list($i_opening);
- # Note: we have to allow for one extra space after a
- # closing token so that we do not strand a comma or
- # semicolon, hence the '>=' here (oneline.t)
+ # Note: we have to allow for at least one extra space after
+ # a closing token so that we do not strand a comma or
+ # semicolon. (oneline.t).
$is_long_term =
- $self->excess_line_length( $i_opening_minus, $i ) >= 0;
+ $self->excess_line_length( $i_opening_minus, $i ) >
+ -$length_tol;
} ## end if ( !$is_long_term &&...)
# We've set breaks after all comma-arrows. Now we have to
=over 4
+=item B<Use increased line length tolerance if ci exceeds i>
+
+In testing perltidy with random input parameters, some blinking states occurred
+when the value of -ci was significantly larger than the value of -i. (In
+actual practice, -ci is not normally set greater than -i). This update adds a
+tolerance to line length tests which avoids this problem. This fixes the
+following cases
+
+b775 b776 b826 b908 b910 b911 b923 b925 b926 b927
+
+14 Feb 2021.
+
=item B<Keep space between binary plus or minus and a bareword>
This update makes a space between a binary + or - and a bareword
+ or - on the next pass, which can lead to blinking states.
Fixes cases b660 b670 b780 b781 b787 b788 b790.
-13 Feb 2021.
+13 Feb 2021, cf414fe.
=item B<Prevent breaks after unary plus and minus>
Some alternating states were produced when extremely maximum line lengths
forced a break after a unary plus or minus. Fixes cases b670 b790.
-13 Feb 2021.
+13 Feb 2021, cf414fe.
=item B<Add line length test for the -vtc=2 option>