From: Steve Hancock Date: Mon, 15 Feb 2021 21:27:17 +0000 (-0800) Subject: Restrict breaking at old uncontained commas X-Git-Tag: 20210402~46 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=98b41a0882cda23c897c768fc7a568c911f6b385;p=perltidy.git Restrict breaking at old uncontained commas --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 54d27c12..1cfd1035 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -14421,7 +14421,15 @@ sub set_continuation_breaks { # it can lead to "blinkers". my $ibreakm = $ibreak; $ibreakm-- if ( $types_to_go[$ibreakm] eq 'b' ); - if ( $ibreakm >= 0 && $types_to_go[$ibreakm] !~ /^[\(\{\[L]$/ ) + + # In order to avoid blinkers we have to be fairly restrictive. + # This has been updated to avoid breaking at any sequenced item, + # so now ternary operators are included, plus closing tokens. + # (see case b931, which is similar to the above print example) + ##This works too but is a little more restrictive: + ##if ( $ibreakm >= 0 && !$type_sequence_to_go[$ibreakm] ) { + if ( $ibreakm >= 0 + && $types_to_go[$ibreakm] !~ /^[\(\{\[L\?\:]$/ ) { $self->set_forced_breakpoint($ibreak); } diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 486e7191..0bf55455 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,16 @@ =over 4 +=item B + +Random testing with very short maximum line lengths produced some blinking +states which were traced to duplicating old comma breakpoints which +were not really good breakpoints. A patch was made to be more selective. + +These cases are fixed with this update: b610 b757 b931 + +15 Feb 2021. + =item B The line length test which was added Feb 13 2021 turns out to be more restrictive @@ -10,7 +20,7 @@ would be formed. This prevents it from needlessly changing existing formatting. The following cases were re-activated after this update: b654 b655 b656 b862 -15 Feb 2021. +15 Feb 2021, 4673fdd. =item B