From: Steve Hancock Date: Sun, 29 May 2022 14:15:39 +0000 (-0700) Subject: disallow kbb='(' - can cause math formatting instability X-Git-Tag: 20220613~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=29fe4ad222abb58c16f3debd909d1aeebc337cb7;p=perltidy.git disallow kbb='(' - can cause math formatting instability --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 26abfd7f..0eda8994 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -9880,6 +9880,46 @@ print to_json({success => $success ? 1 : 0}); --variable-maximum-line-length --weld-nested-containers +==> b1346.in <== + return ( + $s + $t - $a / 3, + -0.5 * ( $s + $t ) + + sqrt(-1) * sqrt(3) / 2 * + ( $s - $t ) - + ( $a / 3 ), + -0.5 * ( $s + $t ) - + sqrt(-1) * + sqrt(3) / 2 * + ( $s - $t ) - ( $a / 3 ) + ); + + return ( + $s + $t - $a / 3, + -0.5 * ( $s + $t ) + sqrt(-1) * sqrt(3) / 2 * + ( $s - $t ) - + ( $a / 3 ), + -0.5 * ( $s + $t ) - sqrt(-1) * sqrt(3) / 2 * + ( $s - $t ) - ( $a / 3 ) + ); + + + return ( + $s + $t - $a / 3, + -0.5 * ( $s + $t ) + + sqrt(-1) * sqrt(3) / 2 * + ( $s - $t ) - + ( $a / 3 ), + -0.5 * ( $s + $t ) - + sqrt(-1) * sqrt(3) / 2 * + ( $s - $t ) - ( $a / 3 ) + ); + +==> b1346.par <== +--keep-old-breakpoints-before=' n ( ' +--continuation-indentation=6 +--maximum-line-length=60 +--extended-continuation-indentation + ==> b140.in <== $cmd[ $i ]=[ $s, $e, $cmd, \@hunk, $i ] ; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 5933fd19..597938ec 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -2305,6 +2305,11 @@ list is: @list; EOM } + # ignore kbb='(' : can cause unstable math formatting (issue b1346) + if ( $short_name eq 'kbb' ) { + @list = grep { $_ !~ /\(/ } @list; + } + # pull out any any leading container code, like f( or *{ # For example: 'f(' becomes flags hash entry '(' => 'f' foreach my $item (@list) {