From: Steve Hancock Date: Fri, 26 Nov 2021 14:35:21 +0000 (-0800) Subject: fix problem with -bbp and -xlp X-Git-Tag: 20211029.02~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c99afdca1820c2a3fa947a41d96684e80c1cc4a7;p=perltidy.git fix problem with -bbp and -xlp --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 7c5f4fc5..717523e6 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -19772,8 +19772,6 @@ sub get_available_spaces_to_go { my $mll = $maximum_line_length_at_level[ $levels_to_go[$i_test] ]; - my $bbc_flag = $break_before_container_types{$token}; - if ( # the equals is not just before an open paren (testing) @@ -19787,9 +19785,6 @@ sub get_available_spaces_to_go { || ( $seqno && $rbreak_before_container_by_seqno->{$seqno} ) - # or if we MIGHT want a break (fixes case b826 b909 b989) - || ( $bbc_flag && $bbc_flag >= 2 ) - # or we are beyond the 1/4 point and there was an old # break at an assignment (not '=>') [fix for b1035] || ( @@ -19813,8 +19808,17 @@ sub get_available_spaces_to_go { # then make the switch -- note that we do not set a # real breakpoint here because we may not really need # one; sub break_lists will do that if necessary. - $ii_begin_line = $i_test + 1; - $lp_position_predictor = $test_position; + + # But only if the closing token is in this batch (c117). + # Otherwise it cannot be done by sub break_lists. + my $K_closing_container = + $self->[_K_closing_container_]; + my $Kc = $K_closing_container->{$seqno}; + if ( defined($Kc) && $Kc <= $K_to_go[$max_index_to_go] ) + { + $ii_begin_line = $i_test + 1; + $lp_position_predictor = $test_position; + } } } } ## end update position predictor