]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix issue b1355
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 26 Jun 2022 14:49:51 +0000 (07:49 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 26 Jun 2022 14:49:51 +0000 (07:49 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index d8c3e3786ab965f7a89ac82eea389eddd738dbda..29c1534cb13d1fc1128a568c1ce19e101e712d8c 100644 (file)
@@ -9973,6 +9973,26 @@ while (my ( $sid, $u, $lasttime )=
 --indent-columns=9
 --maximum-line-length=35
 
+==> b1355.in <==
+# S1
+my $data = [
+ { value => "Tom" },
+ { value => 33 },
+ { value => "Sales" },
+];
+
+# S2
+my $data =
+ [ { value => "Tom" }, { value => 33 }, { value => "Sales" }, ];
+
+
+==> b1355.par <==
+--break-before-square-bracket-and-indent=2
+--break-before-square-bracket=2
+--continuation-indentation=9
+--indent-columns=1
+--maximum-line-length=72
+
 ==> b140.in <==
 $cmd[ $i ]=[
         $s, $e, $cmd, \@hunk, $i ] ;
index afc947a3ef717feb0100bbada302ddf5d83cdc4e..4ad43c635634476310e304fc83d9e99f13bbc471 100644 (file)
@@ -1582,10 +1582,13 @@ EOM
 
             # (1) -lp is not compatible with opt=2, silently set to opt=0
             # (2) opt=0 and 2 give same result if -i=-ci; but opt=0 is faster
+            # (3) set opt=0 if -i < -ci (can be unstable, case b1355)
             if ( $opt == 2 ) {
-                if (   $rOpts->{'line-up-parentheses'}
-                    || $rOpts->{'indent-columns'} ==
-                    $rOpts->{'continuation-indentation'} )
+                if (
+                    $rOpts->{'line-up-parentheses'}
+                    || ( $rOpts->{'indent-columns'} <=
+                        $rOpts->{'continuation-indentation'} )
+                  )
                 {
                     $opt = 0;
                 }