From: Steve Hancock Date: Fri, 26 Feb 2021 14:52:10 +0000 (-0800) Subject: Improve line length test for the -vtc=2 option X-Git-Tag: 20210402~35 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=80107e0a6dfe76c312dbce8350a1bed5114f6d6a;p=perltidy.git Improve line length test for the -vtc=2 option --- diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 83082643..bba32388 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -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 = diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 1abac0c4..4e3ab857 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,19 @@ =over 4 +=item B + +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 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