From: Steve Hancock Date: Mon, 5 Apr 2021 20:56:02 +0000 (-0700) Subject: Modify a condition for applying -bbx=2 X-Git-Tag: 20210402.01~82 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=16c4591cbc4369b30015ac4736f7a2942fdd10a0;p=perltidy.git Modify a condition for applying -bbx=2 --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 905f0b96..1147c8b3 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -6001,12 +6001,22 @@ sub respace_tokens { if ($line_diff) { $rhas_broken_list->{$seqno_parent} = 1; - # We need to mark broken lists with non-terminal + # Patch1: We need to mark broken lists with non-terminal # line-ending commas for the -bbx=2 parameter. This insures # that the list will stay broken. Otherwise the flag # -bbx=2 can be unstable. This fixes case b789 and b938. - $rhas_broken_list_with_lec->{$seqno_parent} = 1 - if ( $rlec_count_by_seqno->{$seqno} ); + + # Patch2: Updated to also require either one fat comma or + # one more line-ending comma. Fixes cases b1069 b1070 + # b1072 b1076. + if ( + $rlec_count_by_seqno->{$seqno} + && ( $rlec_count_by_seqno->{$seqno} > 1 + || $rtype_count_by_seqno->{$seqno}->{'=>'} ) + ) + { + $rhas_broken_list_with_lec->{$seqno_parent} = 1; + } } $seqno_parent = $rparent_of_seqno->{$seqno_parent}; } diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 930a08db..45960e1d 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -3,6 +3,19 @@ =over 4 +=item B + +Random testing produced some edge cases in which formatting with the -bbx=2 flags, +in combination with certain other parameters, was not converging. An existing +criterion for the -bbx=2 flag to apply is that there be a broken sub-list with at +least one line-ending comma. This was updated to also require either a fat comma or +one additional line-ending comma. This filters out some problem cases without +changing much existing formatting. + +This update fixes cases b1068 b1069 b1070 b1072 b1073 b1076. + +5 Apr 2021. + =item B The previous update produced some problems in testing which are corrected