]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix rare indentation issue, c435
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 16 Dec 2024 22:58:56 +0000 (14:58 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 16 Dec 2024 22:58:56 +0000 (14:58 -0800)
dev-bin/run_convergence_tests.pl.expect
lib/Perl/Tidy/Formatter.pm
t/snippets/expect/break_old_methods.break_old_methods
t/snippets15.t

index 20ce74ec2d311534ce160915eb582ae2705c207d..9f4fd7e8114d024d09dacca7c1a63006d58531f1 100644 (file)
@@ -5131,7 +5131,7 @@ $bc[
       =sqrt (
     (
       $vecs**2
-  )->sumover )
+    )->sumover )
       +0.0001;
 
   # S2
@@ -5139,7 +5139,7 @@ $bc[
       =sqrt (
     (
       $vecs**2
-  )->sumover )
+    )->sumover )
       +0.0001;
 
 ==> b1218 <==
@@ -6410,12 +6410,12 @@ my %config = (
         my $h =
           $integerValue->copy()->bmod(
                                       '16'
-        )->bstr();
+          )->bstr();
 
         my $h =
           $integerValue->copy()->bmod(
                                       '16'
-        )->bstr();
+          )->bstr();
 
 ==> b1319 <==
 # S1
index 185ed9e5a253802e4904ed693123a4e62e49b7e2..fba874bec3f31ba8f21edcdef88a4ae61fa237e8 100644 (file)
@@ -39828,6 +39828,21 @@ sub make_paren_name {
             # not a closing type
         }
 
+        # A final check: reset the flag value from 1 to 0 if moving left would
+        # give this closing token less indentation than the line with its
+        # opening token. We could do this check at the top for more efficiency
+        # except for -lp.  For -lp, if the $adjust_indentation flag flips from
+        # 1 to 2, then the -lp logic can do a better recovery if it knows that
+        # the $default_adjust_indentation=1 instead of 0 (c435)
+        if ( $adjust_indentation == 1 ) {
+            my $no_left_adjustment_space = defined($opening_indentation)
+              && get_spaces($leading_spaces_beg) <=
+              get_spaces($opening_indentation);
+            if ($no_left_adjustment_space) {
+                $adjust_indentation = 0;
+            }
+        }
+
         return (
 
             $adjust_indentation,
index 943f5a610ea7433ce07551d762a354a20d128ef7..ce39954ce9bdba9cecea5aaf778101315cdcaced 100644 (file)
@@ -5,4 +5,4 @@ my $q = $rs
     {
         'track.id' => { -ident => 'none_search.id' },
     }
-)->as_query;
+  )->as_query;
index eac77b011d4a3aaff6674b0d057f3566f4dbee39..21f4498af21b0b08b5b81d153df5b4180f7bd195 100644 (file)
@@ -289,7 +289,7 @@ my $q = $rs
     {
         'track.id' => { -ident => 'none_search.id' },
     }
-)->as_query;
+  )->as_query;
 #6...........
         },