From 2b8846422be7cc1847d859db32812df0fe138384 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 26 Feb 2021 09:31:48 -0800 Subject: [PATCH] Restrict previous update to just -vmll --- lib/Perl/Tidy/VerticalAligner.pm | 17 ++++++++++------- local-docs/BugLog.pod | 13 +++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index bba32388..3100eda0 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -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 = diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 92bfa5ae..5e260d37 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,19 @@ =over 4 +=item B + +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 This fixes case b965. The -vmll flag can produce gaps in lines which need to -- 2.39.5