From 3c9b19e40fc5ac8735726a127de288f0f7c549ed Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Tue, 30 Jun 2020 13:35:05 -0700 Subject: [PATCH] minor fix for '!' in alignments --- lib/Perl/Tidy/Formatter.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 2f7ec452..a42e5c6e 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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 -- 2.39.5