]> git.donarmstrong.com Git - perltidy.git/commitdiff
Modify a condition for applying -bbx=2
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 5 Apr 2021 20:56:02 +0000 (13:56 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 5 Apr 2021 20:56:02 +0000 (13:56 -0700)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index 905f0b968472bbdacb3113bc8740afa54aac9a86..1147c8b33bbecb3a095e1264c5199ca475aba065 100644 (file)
@@ -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};
             }
index 930a08db0d1e29d049019fe48c8d815b23a710a8..45960e1d7cf9512d4bc2cfce2ff2e000c344ac40 100644 (file)
@@ -3,6 +3,19 @@
 
 =over 4
 
+=item B<Modify a condition for applying -bbx=2>
+
+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<Improve previous -wn update>
 
 The previous update produced some problems in testing which are corrected