From: Steve Hancock Date: Sat, 25 Jun 2022 17:24:26 +0000 (-0700) Subject: fix issue b1354 X-Git-Tag: 20220613.01~18 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bf51f20cde46704339dc50a13280c8a2d73ba8d5;p=perltidy.git fix issue b1354 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 0eda8994..1fc66644 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -9920,6 +9920,22 @@ print to_json({success => $success ? 1 : 0}); --maximum-line-length=60 --extended-continuation-indentation +==> b1354.in <== +# S1 +while ( + my ( $sid, $u, $lasttime ) + = split( /:/, ) ) + +# S2 +while (my ( $sid, $u, $lasttime )= + split( /:/, ) ) + + +==> b1354.par <== +--noadd-whitespace +--indent-columns=9 +--maximum-line-length=35 + ==> b140.in <== $cmd[ $i ]=[ $s, $e, $cmd, \@hunk, $i ] ; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 316e3c20..4da4b441 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -19008,11 +19008,16 @@ EOM # as '}') which forms a one-line block, this break might # get undone. - # And do not do this at an equals if the user wants - # breaks before an equals (blinker cases b434 b903) - unless ( $type eq '=' && $want_break_before{$type} ) { - $want_previous_breakpoint = $i; - } + # But do not do this at an '=' if: + # - the user wants breaks before an equals (b434 b903) + # - or -naws is set (can be unstable, see b1354) + my $skip = $type eq '=' + && ( $want_break_before{$type} + || !$rOpts_add_whitespace ); + + $want_previous_breakpoint = $i + unless ($skip); + } ## end if ( $next_nonblank_type...) } ## end if ($rOpts_break_at_old_keyword_breakpoints)