From: Steve Hancock Date: Sun, 15 Aug 2021 23:52:50 +0000 (-0700) Subject: Improved line break, case c060 X-Git-Tag: 20210717.02~45 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9d1c8a9b36924f2cd8d52bde822c846814bf798e;p=perltidy.git Improved line break, case c060 --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index a3c76d46..da7f321c 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -14507,6 +14507,15 @@ sub break_equals { && $nesting_depth_to_go[$ibeg_3] == $nesting_depth_to_go[$ibeg_2] ); + # Combine a trailing && term with an || term: fix for c060 + # This is rare but can happen. + $ok ||= 1 + if ( $ibeg_3 < 0 + && $type_ibeg_2 eq '&&' + && $type_ibeg_1 eq '||' + && $nesting_depth_to_go[$ibeg_2] == + $nesting_depth_to_go[$ibeg_1] ); + next if !$ok && $want_break_before{$type_ibeg_2}; $forced_breakpoint_to_go[$iend_1] = 0; diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index c06df874..87c7eb2f 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,29 @@ =over 4 +=item B + +The default formatting produced an undesirable line break at the last '&&' term +in the following: + + my $static = grep { + $class =~ /^$_$/ + || $fullname =~ /^$_$/ + || $method_name =~ /^$_$/ + && ( $class eq 'main' ) + } grep { !m![/\\.]! } $self->dispatch_to; # filter PATH + +This update corrects this to give + + my $static = grep { + $class =~ /^$_$/ + || $fullname =~ /^$_$/ + || $method_name =~ /^$_$/ && ( $class eq 'main' ) + } grep { !m![/\\.]! } $self->dispatch_to; # filter PATH + +15 Aug 2021. + + =item B Testing with random parameters triggered an an internal error check. This was @@ -17,14 +40,14 @@ Testing with random parameters produced unstable formatting involving parameters which included -lp -sbvtc=1. This update fixes this problem, case b1193. -13 Aug 2021. +13 Aug 2021, d4c3425. =item B The ultimate cause of the undefined variable reference in the previous issue was found to be a typo in the tokenizer. This update finishes fixing issue c055. -10 Aug 2021 +10 Aug 2021, 2963db3 =item B