]> git.donarmstrong.com Git - perltidy.git/commitdiff
minor fix for '!' in alignments
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 30 Jun 2020 20:35:05 +0000 (13:35 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 30 Jun 2020 20:35:05 +0000 (13:35 -0700)
lib/Perl/Tidy/Formatter.pm

index 2f7ec452d013df0def922a295071f1675364cd61..a42e5c6e3f874517c00ae19bfd253cec29878b8e 100644 (file)
@@ -10842,6 +10842,18 @@ sub send_lines_to_vertical_aligner {
 
                         # Sum length from previous alignment
                         my $len = token_sequence_length( $i_start, $i - 1 );
+
+                       # Minor patch: do not include the length of any '!'.
+                       # Otherwise, commas in the following line will not
+                       # match
+                        #  ok( 20, tapprox( ( pdl 2,  3 ), ( pdl 2, 3 ) ) );
+                        #  ok( 21, !tapprox( ( pdl 2, 3 ), ( pdl 2, 4 ) ) );
+                        if ( grep { $_ eq '!' }
+                            @types_to_go[ $i_start .. $i - 1 ] )
+                        {
+                            $len -= 1;
+                        }
+
                         if ( $i_start == $ibeg ) {
 
                             # For first token, use distance from start of line