From: Steve Hancock Date: Thu, 18 Nov 2021 19:04:55 +0000 (-0800) Subject: fix b1257, rare instability in math formatting X-Git-Tag: 20211029.01~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=106ca67521850823f2f2a9131ac15e7339dd4a94;p=perltidy.git fix b1257, rare instability in math formatting --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 0e6a822b..b73404ef 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -8274,6 +8274,24 @@ printf --paren-vertical-tightness-closing=2 --weld-nested-containers +==> b1257.in <== +# S1 + my $hour_angle + = 2 * PI + * ( $hour / 12 + $min / ( 12 * 60 ) ) + - PI + / 2; + +# S2 + my $hour_angle + = 2 * PI + * ( $hour / 12 + $min / ( 12 * 60 ) ) + - PI / 2; + +==> b1257.par <== +--break-before-all-operators +--maximum-line-length=50 + ==> b131.in <== unless ( open( SCORE, "+>>$Score_File" ) ) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 9825dfdd..3679fa1e 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -3740,6 +3740,7 @@ EOM # strength on both sides of a blank is the same if ( $type eq 'b' && $last_type ne 'b' ) { $bond_strength_to_go[$i] = $bond_strength_to_go[ $i - 1 ]; + $nobreak_to_go[$i] ||= $nobreak_to_go[ $i - 1 ]; # fix for b1257 next; } @@ -15628,7 +15629,7 @@ sub break_equals { } # honor no-break's - next if ( $bs >= NO_BREAK - 1 ); + ## next if ( $bs >= NO_BREAK - 1 ); # removed for b1257 # remember the pair with the greatest bond strength if ( !$n_best ) {