From: Steve Hancock Date: Fri, 20 Jan 2023 15:17:08 +0000 (-0800) Subject: fix b1444 X-Git-Tag: 20221112.04~11 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=71a7d51f0a79bedf2c59cb0d136b812e612d81fe;p=perltidy.git fix b1444 --- diff --git a/dev-bin/run_convergence_tests.pl b/dev-bin/run_convergence_tests.pl index d26c25e4..5562161a 100755 --- a/dev-bin/run_convergence_tests.pl +++ b/dev-bin/run_convergence_tests.pl @@ -400,7 +400,7 @@ sub run_test_cases { } } else { - $msg = "NEW EXPECT"; + $msg = "..NEW"; push @expect_cases_to_update, $sname; $rexpect_files->{$sname} = $output; } @@ -453,9 +453,9 @@ SKIPPED: these requested cases were not found in the database: EOM } if (@expect_cases_to_update) { + my $new_expect = @expect_cases_to_update; print < b1444.in <== + while ( my ( $k, $v ) + = each %{ $self->{channels}->{$chk}->{device_cache} + } ) + { + ...; + } + + while ( my ( $k, $v ) + = each %{$self->{channels}->{$chk}->{device_cache} } + ) + { + ...; + } + + +==> b1444.par <== +--brace-vertical-tightness-closing=1 +--break-before-all-operators +--continuation-indentation=7 +--extended-continuation-indentation +--extended-line-up-parentheses +--indent-columns=9 +--maximum-line-length=79 +--space-keyword-paren +--vertical-tightness=1 + ==> b146.in <== # State 1 diff --git a/dev-bin/run_convergence_tests.pl.expect b/dev-bin/run_convergence_tests.pl.expect index 4b510ec7..d23bffa0 100644 --- a/dev-bin/run_convergence_tests.pl.expect +++ b/dev-bin/run_convergence_tests.pl.expect @@ -7653,6 +7653,26 @@ $last = after ( } _search_ISA($pkg); +==> b1444 <== + while ( my ( $k, $v ) + = each %{ + $self->{channels}->{$chk}->{device_cache} + } + ) + { + ...; + } + + while ( my ( $k, $v ) + = each %{ + $self->{channels}->{$chk}->{device_cache} + } + ) + { + ...; + } + + ==> b146 <== # State 1 diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index efca6d13..236d88f0 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -22348,9 +22348,26 @@ EOM if ( $minimum_depth <= $current_depth ) { if ( $i_opening >= 0 ) { - $self->set_forced_breakpoint($i_opening) - unless ( $do_not_break_apart - || is_unbreakable_container($current_depth) ); + if ( !$do_not_break_apart + && !is_unbreakable_container($current_depth) ) + { + $self->set_forced_breakpoint($i_opening); + + # Do not let brace types L/R use vertical tightness + # flags to recombine if we have to break on length + # because instability is possible if both vt and vtc + # flags are set ... see issue b1444. + if ( $is_long_term + && $types_to_go[$i_opening] eq 'L' + && $opening_vertical_tightness{'{'} + && $closing_vertical_tightness{'}'} ) + { + my $seqno = $type_sequence_to_go[$i_opening]; + if ($seqno) { + $self->[_rbreak_container_]->{$seqno} = 1; + } + } + } } # break at ',' of lower depth level before opening token