]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix issue b1381
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 11 Oct 2022 22:02:29 +0000 (15:02 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 11 Oct 2022 22:02:29 +0000 (15:02 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index bd8e73fefc3ff696bb8d4614ea45f49a2cebc418..e3cf6f1c94ec4bf93d9595117eef28f047688f0f 100644 (file)
@@ -10221,6 +10221,30 @@ print star (
 --variable-maximum-line-length
 --vertical-tightness-closing=2
 
+==> b1381.in <==
+my $formatter = new HTML::FormatPS(
+    'PaperSize'   => 'Letter', 'LeftMargin' => 20,    # in points
+    'RightMargin' => 20,                              # ditto
+    'TopMargin'   => 10, 'BottomMargin' => 30,
+    'FontFamily'  => 'Helvetica', );
+
+my $formatter = new HTML::FormatPS(
+    'PaperSize'   => 'Letter', 'LeftMargin' => 20,    # in points
+    'RightMargin' => 20,                              # ditto
+    'TopMargin'   => 10, 'BottomMargin' => 30, 'FontFamily' => 'Helvetica'
+);
+
+==> b1381.par <==
+--add-trailing-commas
+--comma-arrow-breakpoints=3
+--delete-trailing-commas
+--extended-continuation-indentation
+--ignore-old-breakpoints
+--maximum-line-length=70
+--paren-vertical-tightness-closing=1
+--want-trailing-commas='b'
+--variable-maximum-line-length
+
 ==> b140.in <==
 $cmd[ $i ]=[
         $s, $e, $cmd, \@hunk, $i ] ;
index 4ecdade29fb42b698f217a07eb551e95feff949a..38f3aea9f7169f35c2f07096b2d998631a0d24b2 100644 (file)
@@ -8101,8 +8101,9 @@ sub match_trailing_comma_rule {
             $rLL_new );
     }
 
-    # Fix for b1379, b1380, part 1. Mark bare trailing commas for use by -vtc
-    # logic to avoid instability when -dtc and -atc are both active.
+    # Fix for b1379, b1380, b1381, b1382 part 1. Mark bare trailing commas for
+    # use by -vtc logic to avoid instability when -dtc and -atc are both
+    # active.
     if ( $match
         && ( $trailing_comma_style eq 'b' || $trailing_comma_style eq 'h' ) )
     {
@@ -27500,13 +27501,14 @@ sub set_vertical_tightness_flags {
                 $cvt = 1;
             }
 
-            # Fix for b1379, b1380, part 2. In some rare cases, -cvt=2 can be
-            # unstable with adding and deleting trailing bare commas.
-            # Reducing to -cvt=1 seems to restore stability.
-            if (   $cvt == 2
+            # Fix for b1379, b1380, b1381, b1382 part 2.
+            # Instablility with adding and deleting trailing bare commas.
+            # Reducing -cvt=2 to -cvt=1 fixes stability in b1379, b1380.
+            # Reducing -cvt>0 to -cvt=0 fixes stability in b1381, b1382.
+            if (   $cvt
                 && $self->[_ris_bare_trailing_comma_by_seqno_]->{$seqno} )
             {
-                $cvt = 1;
+                $cvt = 0;
             }
 
             if (