]> git.donarmstrong.com Git - perltidy.git/commitdiff
Restrict previous update to just -vmll
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 26 Feb 2021 17:31:48 +0000 (09:31 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 26 Feb 2021 17:31:48 +0000 (09:31 -0800)
lib/Perl/Tidy/VerticalAligner.pm
local-docs/BugLog.pod

index bba32388003a9b5071ffb141631f8c3ced3d7643..3100eda019eeac8aec399afa5edd4538b4d3db12 100644 (file)
@@ -458,9 +458,6 @@ 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();
     }
@@ -4875,10 +4872,16 @@ 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).
-                # 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 ) {
+                # Patched to fix cases b656 b862 b971 b972: always do the check
+                # if -vmll is set.  The reason is that the -vmll option can
+                # cause changes in the maximum line length, leading to blinkers
+                # if not checked.
+                if (
+                    $gap >= 0
+                    && ( $self->[_rOpts_variable_maximum_line_length_]
+                        || ( defined($level_end) && $level > $level_end ) )
+                  )
+                {
                     my $test_line_length =
                       $cached_line_text_length + $gap + $str_length;
                     my $maximum_line_length =
index 92bfa5ae5caae2fb0f094d2af8053c96a5561e32..5e260d371592ca827a8d9d2f4d52a87bc17e134d 100644 (file)
@@ -2,6 +2,19 @@
 
 =over 4
 
+=item B<Restrict previous update to just -vmll>
+
+The previous update was found to occasionally needlessly change existing
+formatting with very long long lines.  So it is restricted to just when -vmll
+is set.  For example, it is ok to keep the long quote following the opening
+paren in the following case.
+
+  # perltidy -gnu
+  ok( "got to the end without dieing (note without DEBUGGING passing this test means nothing)"
+    );
+
+26 Feb 2021.
+
 =item B<Add a gap calculation in line length tests with -vmll>
 
 This fixes case b965.  The -vmll flag can produce gaps in lines which need to