From: Steve Hancock Date: Thu, 30 Jun 2022 13:11:21 +0000 (-0700) Subject: fix b1356 X-Git-Tag: 20220613.01~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c7042887ee4c37a17764ef68c5ebf21bc8f62021;p=perltidy.git fix b1356 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 6be37e2f..18849876 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -10067,6 +10067,30 @@ my $data = --indent-columns=1 --maximum-line-length=72 +==> b1356.in <== +# S1 +%phonebook = ( + "Bob" => "247305", + "Phil" => "205832", + "Sara" => "226010" +); + +# S2 +%phonebook + = ( + "Bob" => "247305", + "Phil" => "205832", + "Sara" => "226010" + ); + + +==> b1356.par <== +--continuation-indentation=9 +--extended-line-up-parentheses +--indent-columns=1 +--maximum-line-length=22 +--want-break-before=' = ' + ==> b140.in <== $cmd[ $i ]=[ $s, $e, $cmd, \@hunk, $i ] ; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 742f751c..57f7b048 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -21558,8 +21558,13 @@ sub get_available_spaces_to_go { my $i_test = $last_equals; # Fix for issue b1229, check for break before + # Fix for issue b1356, i_test must never be blank + # ( the ci value for blanks can vary ) if ( $want_break_before{ $types_to_go[$i_test] } ) { - if ( $i_test > 0 ) { $i_test-- } + if ( $i_test > 0 && $types_to_go[ $i_test - 1 ] ne 'b' ) + { + $i_test--; + } } elsif ( $types_to_go[ $i_test + 1 ] eq 'b' ) { $i_test++ }