]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1240, rare instability formatting under stress
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 8 Nov 2021 14:19:29 +0000 (06:19 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 8 Nov 2021 14:19:29 +0000 (06:19 -0800)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index dc64ae2380c627a820b08dcbb6ab25db81dc158c..4822b54858184adb071ee834f6a33058fdec4e54 100644 (file)
@@ -8011,6 +8011,26 @@ is(
 --space-keyword-paren
 --weld-nested-containers
 
+==> b1240.in <==
+# S1
+     printf(
+"Inode Last Change at: %s\n",
+          scalar
+             localtime($ctime) );
+# S2
+     printf(
+"Inode Last Change at: %s\n",
+          scalar localtime(
+                           $ctime)
+     );
+
+==> b1240.par <==
+--continuation-indentation=3
+--extended-continuation-indentation
+--indent-columns=5
+--line-up-parentheses
+--maximum-line-length=34
+
 ==> b1241.in <==
 # created from b901
 # Started blinking with new -lp logic
index 659036fa2cd804b0410c90eb9338b3cf7237e5b5..f38cba873c4a65432e3bbc454caac72bfb6cdaeb 100644 (file)
@@ -17660,6 +17660,16 @@ EOM
 
                     # Do not break hash braces under stress (fixes b1238)
                     $do_not_break_apart ||= $types_to_go[$i_opening] eq 'L';
+
+                    # This option fixes b1235, b1237, b1240 with old and new -lp,
+                    # but formatting is nicer with next option.
+                    ## $is_long_term ||=
+                    ##  $levels_to_go[$i_opening] > $stress_level + 1;
+
+                    # This option fixes b1240 but not b1235, b1237 with new -lp,
+                    # but this gives better formatting than the previous option.
+                    $do_not_break_apart ||=
+                      $levels_to_go[$i_opening] > $stress_level;
                 }
 
                 if (  !$is_long_term