]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix issue b1354
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 25 Jun 2022 17:24:26 +0000 (10:24 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 25 Jun 2022 17:24:26 +0000 (10:24 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 0eda899493fd92340ccffe511a8b69ef1bde2431..1fc66644a7ae41dbcbcedddf3cb739bca6743c5f 100644 (file)
@@ -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( /:/, <S> ) )
+
+# S2
+while (my ( $sid, $u, $lasttime )=
+         split( /:/, <S> ) )
+
+
+==> b1354.par <==
+--noadd-whitespace
+--indent-columns=9
+--maximum-line-length=35
+
 ==> b140.in <==
 $cmd[ $i ]=[
         $s, $e, $cmd, \@hunk, $i ] ;
index 316e3c206ab2d589e44ae452dc1ed58106ee3af9..4da4b441cc019d0f8383121341ea899c8d8de266 100644 (file)
@@ -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)