From d4c342511b36d8cd6459604cf83a9a23d67375c4 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 13 Aug 2021 07:15:31 -0700 Subject: [PATCH] Fix formatting instability, b1193 --- dev-bin/run_convergence_tests.pl.data | 22 ++++++++++++++++++++++ lib/Perl/Tidy/Formatter.pm | 9 +++++++-- local-docs/BugLog.pod | 8 ++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 46e7d511..e97ee529 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -7139,6 +7139,28 @@ print --line-up-parentheses --maximum-line-length=48 +==> b1193.in <== +# S1 + $config->{$key} + =[ + $config->{ + $key} ]; +# S2 + $config->{$key} + =[ + $config->{$key} + ]; + +==> b1193.par <== +--noadd-whitespace +--break-before-all-operators +--continuation-indentation=1 +--delete-old-whitespace +--indent-columns=6 +--line-up-parentheses +--maximum-line-length=49 +--square-bracket-vertical-tightness-closing=1 + ==> b120.in <== # Same as bug96 # State 1 diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 82b11194..64fd31e2 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -15991,13 +15991,18 @@ sub set_continuation_breaks { $length_tol_boost = 0; # was 1 for FIX2, 0 for FIX3 } else { - $length_tol_boost = 0; # was 3 for FIX2, 0 for FIX3 + foreach ( keys %closing_vertical_tightness ) { + next + unless ( $closing_vertical_tightness{$_} ); + $length_tol_boost = 1; # Fixes B1193; + last; + } } } # The -xci option alone also needs a slightly larger tol for non-lists elsif ( $rOpts->{'extended-continuation-indentation'} ) { - $length_tol_boost = 0; # was 1 for FIX2, 0 for FIX3 + $length_tol_boost = 0; # was 1 for FIX2, 0 for FIX3 } return; } diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 0f5abb57..95113ace 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,14 @@ =over 4 +=item B + +Testing with random parameters produced unstable formatting +involving parameters which included -lp -sbvtc=1. This update +fixes this problem, case b1193. + +13 Aug 2021. + =item B The ultimate cause of the undefined variable reference in the previous issue was -- 2.39.5