From: Steve Hancock Date: Mon, 10 Jan 2022 15:10:30 +0000 (-0800) Subject: fix b1302, b1306: rare instability with combo -vmll -xlp -!iscl X-Git-Tag: 20211029.06~23 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6ef8af70f366fdbb4dcd401a3c9934c3a46baaf7;p=perltidy.git fix b1302, b1306: rare instability with combo -vmll -xlp -!iscl --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index ed29a88d..c0af63ef 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -9072,6 +9072,27 @@ subtest '->save' => sub { --space-function-paren --vertical-tightness=1 +==> b1302.in <== +use vars ( + q!$Start_Dir! + , # The top directory find was called with + q!%Future! + , # topdirs find will handle later +); + +use vars ( + q!$Start_Dir! + , # The top directory find was called with + q!%Future!, # topdirs find will handle later +); + +==> b1302.par <== +--extended-line-up-parentheses +--indent-columns=3 +--maximum-line-length=42 +--paren-tightness=2 +--variable-maximum-line-length + ==> b1303.in <== if ( ( @@ -9143,6 +9164,31 @@ my %Map =( --indent-columns=2 --maximum-line-length=53 +==> b1306.in <== +$oreo = + cookie( + -NAME => 'filling', + -VALUE => "vanilla crème", + -EXPIRES => '+3M' + , # M for month, m for minute + -DOMAIN => '.perl.com' + ); + +$oreo = cookie( + -NAME => 'filling', + -VALUE => "vanilla crème", + -EXPIRES => '+3M' + , # M for month, m for minute + -DOMAIN => '.perl.com' +); + + +==> b1306.par <== +--extended-continuation-indentation +--extended-line-up-parentheses +--maximum-line-length=35 +--variable-maximum-line-length + ==> b131.in <== unless ( open( SCORE, "+>>$Score_File" ) ) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 0008c0f2..e93362cb 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -10664,11 +10664,22 @@ sub collapsed_lengths { ) { my $Kend = $K_terminal; - if ( $has_comment && !$rOpts_ignore_side_comment_lengths ) { + + # Ignore comment length if -vmll. Some rare instabilities have + # been found involving side comments and -vmll. So side comment + # lengths are ignored in this loop if -vmll is set for now. + # (They are still checked elsewhere). This could cause + # occasional excess line lengths, but -vmll use is rare and + # that is preferable to instability. Fixes b1302 and b1306. + if ( $has_comment + && !$rOpts_ignore_side_comment_lengths + && !$rOpts_variable_maximum_line_length ) + { $Kend = $K_last; } $len = $rLL->[$Kend]->[_CUMULATIVE_LENGTH_] - $rLL->[ $K_first - 1 ]->[_CUMULATIVE_LENGTH_]; + if ( $len > $max_prong_len ) { $max_prong_len = $len } # TODO: if there are no sequence items in the line we could