From: Steve Hancock Date: Tue, 30 Jun 2020 20:35:05 +0000 (-0700) Subject: minor fix for '!' in alignments X-Git-Tag: 20200619.02~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3c9b19e40fc5ac8735726a127de288f0f7c549ed;p=perltidy.git minor fix for '!' in alignments --- 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