]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fixed blinker related to large -ci, short line length and -bbsbi=2 -bbsb=1
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 15 Jan 2021 15:55:59 +0000 (07:55 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 15 Jan 2021 15:55:59 +0000 (07:55 -0800)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index a5339bfdc34ae5649dd943a00b70f985b67529c6..5270f5fa9ff240d24b030bb4193b92d32b06b413 100644 (file)
@@ -7557,8 +7557,12 @@ sub adjust_container_indentation {
         # This is only for list containers
         next unless $self->is_list_by_seqno($seqno);
 
-        # and only for broken lists
-        next unless $ris_broken_container->{$seqno};
+        # and only for broken lists. 
+        # Require container to span 3 or more line to avoid blinkers,
+        # so line difference must be 2 or more.
+        next
+          if ( $ris_broken_container->{$seqno}
+            && $ris_broken_container->{$seqno} <= 1 );
 
         # NOTE: We are adjusting indentation of the opening container. The
         # closing container will normally follow the indentation of the opening
index adacec397640a53700650e54366ba4db6abdc6b8..e60c435a294ede2dae3d2e886a33925c2075286a 100644 (file)
@@ -2,6 +2,34 @@
 
 =over 4
 
+=item B<Fixed blinker related to large -ci, short line length and -bbsbi=2 -bbsb=1>
+
+A blinking state was discovered in testing between the following two states
+
+    my$table=
+         [[1,2,3],[2,4,6],[3,6,9],
+         ];
+
+    my$table=
+        [[1,2,3],[2,4,6],[3,6,9],];
+
+with these parameters
+
+    --continuation-indentation=5
+    --maximum-line-length=31
+    --break-before-square-bracket-and-indent=2
+    --break-before-square-bracket=1
+    --noadd-whitespace
+
+The problem was found to be caused by the -bbsb parameters causing
+the indentation level of the first square bracket to change depending
+upon whether the term was broken on input or not.  Two fixes would correct
+this. One is to turn off the option if the -ci=n value exceeds the -i=n
+value. The other is to require a broken container to span at least three
+lines before turning this option on.  The latter option was made
+to sub 'adjust_container_indentation'.  With this change the snippet remains
+stable at the second state above. Fixed 14 Jan 2021.
+
 =item B<Fixed blinker related to large -ci, short line length and -wn>
 
 In random testing with convergence a 'blinker' (oscillating states) was found