]> git.donarmstrong.com Git - perltidy.git/commitdiff
Restrict breaking at old uncontained commas
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 15 Feb 2021 21:27:17 +0000 (13:27 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 15 Feb 2021 21:27:17 +0000 (13:27 -0800)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index 54d27c128e9c7fa3b29880fd4e8da5500834296f..1cfd10358f9c8c05a32f487d12663074d5a3f7ae 100644 (file)
@@ -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);
                 }
index 486e7191f327ae400a24eb8de42e5cd51863086d..0bf55455ec849ff0d68560eea0cac5ec98696744 100644 (file)
@@ -2,6 +2,16 @@
 
 =over 4
 
+=item B<Restrict breaking at old uncontained commas>
+
+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<Modify line length test for the -vtc=2 option>
 
 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<Use increased line length tolerance if ci exceeds i>