From: Steve Hancock Date: Mon, 3 Jan 2022 13:34:33 +0000 (-0800) Subject: fix issue b1301 X-Git-Tag: 20211029.05~7 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ea527f1e2a89db35b67c516c7bed94d6880ffe37;p=perltidy.git fix issue b1301 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 535ce4d3..9526caa0 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -8693,6 +8693,36 @@ my $file = $menubar->Menubutton( --indent-columns=8 --maximum-line-length=65 +==> b1301.in <== +subtest '->save' => sub { + plan tests => 1; + my $layout + =C4::Patroncards::Layout->new (layout_name => "new patron card", + layout_id => '', # The interface send an empty string + layout_xml => 'some_xml' + ); +}; + +subtest '->save' => sub { + plan tests => 1; + my $layout + =C4::Patroncards::Layout->new ( + layout_name => "new patron card", + layout_id => '', # The interface send an empty string + layout_xml => 'some_xml' + ); +}; + +==> b1301.par <== +--break-before-all-operators +--continuation-indentation=0 +--extended-line-up-parentheses +--ignore-side-comment-lengths +--maximum-line-length=70 +--nowant-right-space='- = .= **= *= + >= >>= ||= != <<= >= + ||= < /= //=' +--space-function-paren +--vertical-tightness=1 + ==> b131.in <== unless ( open( SCORE, "+>>$Score_File" ) ) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 8c54ff8a..be64b967 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -10676,8 +10676,17 @@ sub collapsed_lengths { { $Kend = $K_last; } + + # Measure from the next blank if any (fixes b1301) + my $Kbeg = $KK; + if ( $rLL->[ $Kbeg + 1 ]->[_TYPE_] eq 'b' + && $Kbeg < $Kend ) + { + $Kbeg++; + } my $len = $rLL->[$Kend]->[_CUMULATIVE_LENGTH_] - - $rLL->[$KK]->[_CUMULATIVE_LENGTH_]; + $rLL->[$Kbeg]->[_CUMULATIVE_LENGTH_]; + if ( $len > $max_prong_len ) { $max_prong_len = $len } }