]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix rare formatting instability b1223, b1227
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 4 Oct 2021 13:45:50 +0000 (06:45 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 4 Oct 2021 13:45:50 +0000 (06:45 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index 9ce2592d3e53da6d8d4d96d00c77a703cfd8f63d..e972075c9778a54a43f662bb86dd9fcfb0e7076f 100644 (file)
@@ -7575,6 +7575,36 @@ print$msg,
 --weld-nested-containers
 --space-function-paren
 
+==> b1227.in <==
+# S1
+foreach$n(qw( msm ali ))
+{
+    foreach$e(qw(
+              uc16
+    ));
+}
+
+# S2
+foreach$n(qw( msm ali ))
+{   foreach$e(qw(
+              uc16
+              ) );
+}
+
+==> b1227.par <==
+
+
+
+--noadd-whitespace
+--block-brace-vertical-tightness=1
+--continuation-indentation=10
+--delete-old-whitespace
+--line-up-parentheses
+--opening-brace-on-new-line
+--paren-vertical-tightness-closing=1
+--stack-opening-paren
+--weld-nested-containers
+
 ==> b131.in <==
         unless
           ( open( SCORE, "+>>$Score_File" ) )
index 79b08273f34d9b4b0a8ad8226f446cfef340b058..ff1f90e5370cba2c21539b6209115984b84f6f92 100644 (file)
@@ -8098,6 +8098,7 @@ sub setup_new_weld_measurements {
     # - Require blank before certain previous characters to fix b1111.
     # - Add ';' to fix case b1139
     # - Convert from '$ok_to_weld' to '$new_weld_ok' to fix b1162.
+    # - relaxed constraints for b1227
     if (   $starting_ci
         && $rOpts_line_up_parentheses
         && $rOpts_delete_old_whitespace
@@ -8110,16 +8111,20 @@ sub setup_new_weld_measurements {
         my $type_pp     = 'b';
         if ( $Kprev >= 0 ) { $type_pp = $rLL->[ $Kprev - 1 ]->[_TYPE_] }
         unless (
-               $type_prev  =~ /^[\,\.\;]/
-            || $type_prev  =~ /^[=\{\[\(\L]/ && $type_pp eq 'b'
+               $type_prev =~ /^[\,\.\;]/
+            || $type_prev =~ /^[=\{\[\(\L]/
+            && ( $type_pp eq 'b' || $type_pp eq '}' || $type_first eq 'k' )
             || $type_first =~ /^[=\,\.\;\{\[\(\L]/
             || $type_first eq '||'
-            || (   $type_first eq 'k' && $token_first eq 'if'
-                || $token_first eq 'or' )
+            || (
+                $type_first eq 'k'
+                && (   $token_first eq 'if'
+                    || $token_first eq 'or' )
+            )
           )
         {
             $msg =
-"Skipping weld: poor break with -lp and ci at type_first='$type_first' type_prev='$type_prev'\n";
+"Skipping weld: poor break with -lp and ci at type_first='$type_first' type_prev='$type_prev' type_pp=$type_pp\n";
             $new_weld_ok = 0;
         }
     }
index 707df233e7c17cb2436f1652ee1d382edc00ce0b..adbb6fa2ef6704c8f8b338d80fbcc0a48dd9907a 100644 (file)
@@ -2,7 +2,7 @@
 
 =over 4
 
-=item B<Fix issue c082, -cscw preventing deletion of closing side comments>
+=item B<Fix issue c081, -cscw preventing deletion of closing side comments>
 
 Random testing revealed a problem in which an old closing side comment was not
 being deleted when it fell below the interval specified on -csci=n
@@ -41,7 +41,7 @@ the threshold and be removed (correctly):
 But if we also add the -cscw flag (warnings) then it was not being removed.  This
 update fixes this problem (issue c081).
 
-2 Oct 2021
+2 Oct 2021, 25ef8e8
 
 =item B<Partial fix for issue git #74 on -lp at anonymous subs>