From: Steve Hancock Date: Tue, 16 Feb 2021 16:07:54 +0000 (-0800) Subject: Do not weld to a hash brace X-Git-Tag: 20210402~44 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=eb2f4e74297e88a30c0fda55f43b8d9aa9a8959d;p=perltidy.git Do not weld to a hash brace --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 73badc8f..f7f4c018 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -6844,10 +6844,12 @@ sub weld_nested_containers { my $iline_io = $inner_opening->[_LINE_INDEX_]; my $iline_ic = $inner_closing->[_LINE_INDEX_]; - # RULE: do not weld to a hash brace unless it is preceded by @ + # RULE: do not weld to a hash brace. The reason is that it has a very + # strong bond strength to the next token, so a line break after it + # may not work. Previously we allowed welding to something like @{ + # but that caused blinking states (cases b751, b779). if ( $inner_opening->[_TYPE_] eq 'L' ) { - my $Kp = $self->K_previous_nonblank($Kinner_opening); - next unless ( defined($Kp) && $rLL->[$Kp]->[_TOKEN_] eq '@' ); + next; } # RULE: do not weld to a square bracket without commas @@ -14429,7 +14431,7 @@ sub set_continuation_breaks { # 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. + # so now ternary operators are included. # (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] ) { diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index e99b064c..c60a4eed 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,16 @@ =over 4 +=item B + +The reason is that it has a very strong bond strength to the next token, so a +line break after it may not work. Previously we allowed welding to something +like '@{' but even that caused blinking states (cases b751, b779). + +This will not change much existing code. This update fixes cases b751 b779. + +16 Feb 2021. + =item B Random testing whith very short maximum line lengths produced some blinking @@ -13,7 +23,7 @@ brace. This update fixes these cases: b900 b902 b928 b929 -15 Feb 2021. +15 Feb 2021, f005a95. =item B