]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1357
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 7 Jul 2022 03:10:08 +0000 (20:10 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 7 Jul 2022 03:10:08 +0000 (20:10 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 188498764e6fb19e3217e8ef0130ae015e1ba7f0..eba60edeb626ed404b2be0b145864f4e4fb70a2f 100644 (file)
@@ -10091,6 +10091,25 @@ my $data =
 --maximum-line-length=22
 --want-break-before=' = '
 
+==> b1357.in <==
+# S1
+my ( $m, $i, $j )
+  =( length $P, 0,
+     -1 );
+
+# S2
+my ( $m, $i, $j ) =(
+             length $P, 0,
+             -1 );
+
+==> b1357.par <==
+--break-at-old-comma-breakpoints
+--extended-line-up-parentheses
+--indent-columns=0
+--maximum-line-length=26
+--nowant-right-space='='
+--want-break-before='='
+
 ==> b140.in <==
 $cmd[ $i ]=[
         $s, $e, $cmd, \@hunk, $i ] ;
index f65e8880b7fffbe0159909e25a788721ba7492e1..5dce2462e4ec14b6b82405867c2ad0d6b45a8167 100644 (file)
@@ -3079,7 +3079,6 @@ sub set_container_ws_by_keyword {
 sub ws_in_container {
 
     my ($j) = @_;
-    my $ws = WS_YES;
     if ( $j + 1 > $jmax ) { return (WS_NO) }
 
     # Patch to count '-foo' as single token so that
@@ -21831,11 +21830,15 @@ sub get_available_spaces_to_go {
 
             # Fix for issue b1229, check for break before
             # Fix for issue b1356, i_test must never be blank
+            # Fix for issue b1357 .. b1370, i_test must be prev nonblank
             #   ( the ci value for blanks can vary )
+            # See also b223
             if ( $want_break_before{ $types_to_go[$i_test] } ) {
-                if ( $i_test > 0 && $types_to_go[ $i_test - 1 ] ne 'b' ) {
-                    $i_test--;
-                }
+                my $i_prev_nb = $i_test - 1;
+                $i_prev_nb -= 1
+                  if ( $types_to_go[$i_prev_nb] eq 'b' );
+                $i_test = $i_prev_nb
+                  if ( $i_prev_nb > $ii_begin_line );
             }
             elsif ( $types_to_go[ $i_test + 1 ] eq 'b' ) { $i_test++ }