From: Steve Hancock Date: Sat, 19 Jun 2021 12:56:48 +0000 (-0700) Subject: Adjust tolerances to fix some unstable edge cases X-Git-Tag: 20210402.01~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4d4970a8bdc97839567d51c60d24eec010e06b07;p=perltidy.git Adjust tolerances to fix some unstable edge cases --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 9bae006e..7f6a4b33 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -15751,6 +15751,8 @@ sub set_continuation_breaks { my $rLL = $self->[_rLL_]; my $ris_list_by_seqno = $self->[_ris_list_by_seqno_]; my $ris_broken_container = $self->[_ris_broken_container_]; + my $rbreak_before_container_by_seqno = + $self->[_rbreak_before_container_by_seqno_]; $starting_depth = $nesting_depth_to_go[0]; @@ -16199,6 +16201,18 @@ sub set_continuation_breaks { ? $length_tol + $length_tol_boost : $length_tol; + # Patch to avoid blinking with -bbxi=2 and -cab=2 + # in which variations in -ci cause unstable formatting + # in edge cases. We just always add one ci level so that + # the formatting is independent of the -BBX results. + # Fixes cases b1137 b1149 b1150 b1155 b1158 b1159 b1160 + # b1161 b1166 b1167 b1168 + if ( !$ci_levels_to_go[$i_opening] + && $rbreak_before_container_by_seqno->{$type_sequence} ) + { + $tol += $rOpts->{'continuation-indentation'}; + } + $is_long_term = $excess + $tol > 0; } ## end if ( !$is_long_term &&...) diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index e8a29473..4c353f4a 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,18 @@ =over 4 +=item B + +Testing with randim input parameters produced a number of edge cases of +unstable formatting which were traced to the parameter combinations which +included -bbxi=2 and -cab=2. A small adjustment to length tolerances was made +to fix the problem. + +This fixes cases b1137 b1149 b1150 b1155 b1158 b1159 b1160 b1161 b1166 b1167 +b1168. + +19 Jun 2021. + =item B This flag, which is enabled by default, allows perltidy to terminate the last @@ -15,7 +27,7 @@ use on a command line. This update also removes the description of the obsolete --check-syntax flag from the man pages and help text. -18 Jun 2021. +18 Jun 2021, 6f83170. =item B @@ -28,7 +40,7 @@ deleted, for example: The same issue was happening for --delete-closing-side comments. This has been fixed. -18 Jun 2021. +18 Jun 2021, dbfd802. =item B @@ -54,7 +66,7 @@ and the following code This update fixes the problem, case b1162. -18 Jun 2021. +18 Jun 2021, 76873ea. =item B