From bcefb5d66833cfee102251a3734c2576746036ca Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 3 Oct 2021 19:07:53 -0700 Subject: [PATCH] fix issue b1212, unusual weld instability --- dev-bin/run_convergence_tests.pl.data | 24 ++++++++++++++++++++++++ lib/Perl/Tidy/Formatter.pm | 7 ++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 4ef25024..9ce2592d 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -7456,6 +7456,30 @@ $bc[ --maximum-line-length=34 --variable-maximum-line-length +==> b1212.in <== +# S1 + my $line_count + = scalar + @{ [lines ()] + }; + +# S2 + my $line_count + = scalar @{ [ + lines () + ] }; + +==> b1212.par <== +--break-before-all-operators +--continuation-indentation=4 +--ignore-old-breakpoints +--indent-columns=2 +--maximum-line-length=17 +--space-function-paren +--square-bracket-tightness=2 +--variable-maximum-line-length +--weld-nested-containers + ==> b1218.in <== # S1 is( diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 170a60bd..79b08273 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -8206,9 +8206,10 @@ sub weld_nested_containers { my $iline_outer_opening = -1; my $weld_count_this_start = 0; - # $single_line_tol added to fix cases b1180 b1181 - my $single_line_tol = - $rOpts_continuation_indentation > $rOpts_indent_columns ? 1 : 0; + # OLD: $single_line_tol added to fix cases b1180 b1181 + # = $rOpts_continuation_indentation > $rOpts_indent_columns ? 1 : 0; + # NEW: $single_line_tol=0; fixes b1212 and b1180-1181 work now + my $single_line_tol = 0; my $multiline_tol = $single_line_tol + 1 + max( $rOpts_indent_columns, $rOpts_continuation_indentation ); -- 2.39.5