]> git.donarmstrong.com Git - perltidy.git/commitdiff
Improve line length test for the -vtc=2 option
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 26 Feb 2021 14:52:10 +0000 (06:52 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 26 Feb 2021 14:52:10 +0000 (06:52 -0800)
lib/Perl/Tidy/VerticalAligner.pm
local-docs/BugLog.pod

index 8308264332b3de15423ed25dc360ba00178b4c12..bba32388003a9b5071ffb141631f8c3ced3d7643 100644 (file)
@@ -458,6 +458,9 @@ sub valign_input {
 
     # Reset side comment location if we are entering a new block from level 0.
     # This is intended to keep them from drifting too far to the right.
+    # Programming Note: this seems to be the only spot where '$level_end' is
+    # used now.  (Formerly it was used in step_B). So eventually it can be
+    # removed elsewhere.
     if ( $terminal_block_type && $level_adj == 0 && $level_end > $level ) {
         $self->forget_side_comment();
     }
@@ -4872,7 +4875,10 @@ sub get_output_line_number {
                 # -xci -pvt=2.  In that case a one-line block alternately forms
                 # and breaks, causing -xci to alternately turn on and off (case
                 # b765).
-                if ( $gap >= 0 && defined($level_end) && $level > $level_end ) {
+                # Patched to fix cases b656 b862 b971 b972: always do the check.
+                # The reason is that the -vmll option can cause changes in the
+                # maximum line length, leading to blinkers if not checked.
+                if ( $gap >= 0 ) {
                     my $test_line_length =
                       $cached_line_text_length + $gap + $str_length;
                     my $maximum_line_length =
index 1abac0c40279d90e4ac838631ed23498bccb16f5..4e3ab8572a09b1f42b96d379a5444ddb2828da81 100644 (file)
@@ -2,6 +2,19 @@
 
 =over 4
 
+=item B<Improve line length test for the -vtc=2 option>
+
+This is a small change to the update of 13 Feb 2021, f79a4f1. Random testing
+produced additional blinking states caused by the combination of -vtc=2 and
+-vmll flag, plus several others. The problem was that a line length check in
+the vertical aligner was being skipped as an optimization if it didn't appear
+necessary. The unusual properties of the -vmll flag require that the check
+always be done.
+
+This fixes cases b656 b862 b971 b972.
+
+26 Feb 2021.
+
 =item B<Improve one-line block length tests>
 
 Some oscillating states produced in random parameter tests were traced
@@ -19,7 +32,7 @@ it was.  To minimize changes in existing formatting, in the new version the -bl
 flag is not applied to these block types.  A future flag could be added to give
 user control over which of these block types are under -bl control.
 
-25 Feb 2021
+25 Feb 2021, 92bec8d.
 
 =item B<Add tolerance to one-line block length tests>