From cf51ff04d071e36df0d179faa0830e89126dbb39 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 7 Jan 2022 05:39:32 -0800 Subject: [PATCH] fix rare instability b1305 involving -bbxi>0 -naws and -ci>-i --- dev-bin/run_convergence_tests.pl.data | 28 +++++++++++++++++++++++++++ lib/Perl/Tidy/Formatter.pm | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 1871c968..74556436 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -8964,6 +8964,34 @@ if (( $response = $browser->request($curreq) --line-up-parentheses --maximum-line-length=52 +==> b1305.in <== +my %Map =( + File::Spec->catfile( + $Dir,"linktest_with_dir.tar" + ) => + [ + [ 0, qr/SECURE EXTRACT MODE/],[ 1, qr/^$/ ] + ], +); + +my %Map =( + File::Spec->catfile( + $Dir,"linktest_with_dir.tar" + ) => + [ + [ 0, qr/SECURE EXTRACT MODE/], + [ 1, qr/^$/ ] + ], +); + +==> b1305.par <== +--noadd-whitespace +--break-before-square-bracket-and-indent=2 +--break-before-square-bracket=1 +--continuation-indentation=6 +--indent-columns=2 +--maximum-line-length=53 + ==> b131.in <== unless ( open( SCORE, "+>>$Score_File" ) ) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 8c687eac..8d7a6145 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -9944,6 +9944,12 @@ sub break_before_list_opening_containers { # Only consider containers already broken next if ( !$ris_broken_container->{$seqno} ); + # Patch to fix issue b1305: the combination of -naws and ci>i appears + # to cause an instability. It should almost never occur in practice. + next + if (!$rOpts_add_whitespace + && $rOpts_continuation_indentation > $rOpts_indent_columns ); + # Always ok to change ci for permanently broken containers if ( $ris_permanently_broken->{$seqno} ) { goto OK; -- 2.39.5