]> git.donarmstrong.com Git - perltidy.git/commitdiff
optimization
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 26 May 2023 22:05:50 +0000 (15:05 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 26 May 2023 22:05:50 +0000 (15:05 -0700)
lib/Perl/Tidy/Formatter.pm

index 5a1ccd2cad66c2716ef9a728207768c4a1533674..c812b9b9429a31c3785cd52ce72941638d213fee 100644 (file)
@@ -26526,8 +26526,25 @@ sub convey_batch_to_vertical_aligner {
     # ----------------------------------------------------------
     # define the vertical alignments for all lines of this batch
     # ----------------------------------------------------------
-    my $rline_alignments =
-      $self->make_vertical_alignments( $ri_first, $ri_last );
+    my $rline_alignments;
+
+    if ( !$max_index_to_go ) {
+
+        # Optional shortcut for single token ...
+        # = [ [ $rtokens, $rfields, $rpatterns, $rfield_lengths ] ];
+        $rline_alignments = [
+            [
+                [],
+                [ $tokens_to_go[0] ],
+                [ $types_to_go[0] ],
+                [ $summed_lengths_to_go[1] - $summed_lengths_to_go[0] ],
+            ]
+        ];
+    }
+    else {
+        $rline_alignments =
+          $self->make_vertical_alignments( $ri_first, $ri_last );
+    }
 
     # ----------------------------------------------
     # loop to send each line to the vertical aligner