]> git.donarmstrong.com Git - perltidy.git/commitdiff
Do not weld to a hash brace
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 16 Feb 2021 16:07:54 +0000 (08:07 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 16 Feb 2021 16:07:54 +0000 (08:07 -0800)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index 73badc8f2481c9f96a9224ae1b419c0747353a79..f7f4c018439622acdcd5771ff6948fbbb1fff38f 100644 (file)
@@ -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] ) {
index e99b064c5b8ff51cf4d8b1e16de9acea84c392c9..c60a4eed5b9a1ace55d5bd6b7b9964819f2b4900 100644 (file)
@@ -2,6 +2,16 @@
 
 =over 4
 
+=item B<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 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<Avoid line breaks after token type 'G'>
 
 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<Restrict breaking at old uncontained commas>