]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fix rare line break problem
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 16 Apr 2021 00:52:50 +0000 (17:52 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 16 Apr 2021 00:52:50 +0000 (17:52 -0700)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index 6cc468c6bbc02454755d422029e4588c9c11a761..01704ff6014dad6d311ba4ed57ed8db64cc4c828 100644 (file)
@@ -15433,7 +15433,15 @@ sub set_continuation_breaks {
             }
 
             $last_old_breakpoint_count = $old_breakpoint_count;
-            if ( $old_breakpoint_to_go[$i] ) {
+
+            # Fixed for case b1097 to not consider old breaks at highly
+            # stressed locations, such as types 'L' and 'R'.  It might be
+            # useful to generalize this concept in the future by looking at
+            # actual bond strengths.
+            if (   $old_breakpoint_to_go[$i]
+                && $type ne 'L'
+                && $next_nonblank_type ne 'R' )
+            {
                 $i_line_end   = $i;
                 $i_line_start = $i_next_nonblank;
 
index 6b28c1307560da5620768f7e3a4ced647f0ccff7..3d8cb8afbb754d96c8af31e943aa25b5aaf7fd44 100644 (file)
@@ -3,6 +3,32 @@
 
 =over 4
 
+=item B<Fix rare line break problem>
+
+Random testing produced case b1097 with this parameter set
+
+    --brace-vertical-tightness-closing=1
+    --continuation-indentation=8
+    --indent-columns=10
+    --maximum-line-length=36
+
+and either this output
+
+          my (@files) = @{
+                    $args{-files} };
+
+or this output
+
+          my (@files) =
+                  @{ $args{-files}
+                  };
+
+The different results were caused by the unusual combination of parameters.
+The problem was fixed by not allowing the formatter to consider existing breaks
+at highly stressed locations such as these.
+
+15 Apr 2021.
+
 =item B<Fix problem parsing anonymous subs with attribute lists>
 
 Random testing produced case b994 with unstable formatting:
@@ -25,7 +51,7 @@ The line 'sub :' was being correctly parsed but the following opening block
 brace was not correctly marked as an anonymous sub brace.  This fixes cases
 b994 and b1053.
 
-15 Apr 2021.
+15 Apr 2021, 84c1123.
 
 =item B<Correct brace types mismarked by tokenizer>
 
@@ -36,7 +62,7 @@ having the tokenizer send a signal to the formatter if a block type was
 guessed.  The formatter has more information and can fix the problem.  This
 fixes case b1085.
 
-11 Apr 2021.
+11 Apr 2021, 7d23bf4.
 
 =item B<Unify coding for welded quotes and other welded containers>