From: Steve Hancock Date: Sun, 5 Nov 2023 22:29:51 +0000 (-0800) Subject: fix issue c302 X-Git-Tag: 20230912.05~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e3b790d489afb116703129bf2663cb5f8bccdeeb;p=perltidy.git fix issue c302 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index cf671134..2b3d7b9d 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -18387,3 +18387,26 @@ s/^([^\t]*)(\t+)/$1.(" " x ((length($2)<<3)-(length($1)&7)))/e ) ==> c190.par <== -pbp -nst -nse -wn -xci -conv -fso -gcs -maxue=3 + +==> c302.in <== +use strict; +use warnings; + +use Params::Validate qw(:all); + +use PVTests; +use Test::More 0.88; +my $String = 'foo'; # blank after this opens and closes + +my $Foo = bless \$v1, 'Foo'; +my $Bar = bless \$v2, 'Bar'; +my $Baz = bless \$v3, 'Baz'; +my $Quux = bless \$v4, 'Quux'; +my $v1; +my ( $v1, $v2, $v3, $v4 ); + + +==> c302.par <== +--keyword-group-blanks-after=2 +--keyword-group-blanks-before=0 +--keyword-group-blanks-size='1.8' diff --git a/dev-bin/run_convergence_tests.pl.expect b/dev-bin/run_convergence_tests.pl.expect index ec324363..03dd2581 100644 --- a/dev-bin/run_convergence_tests.pl.expect +++ b/dev-bin/run_convergence_tests.pl.expect @@ -11386,3 +11386,21 @@ s/^([^\t]*)(\t+)/$1.(" " x ((length($2)<<3)-(length($1)&7)))/e ) . '(&make_deferred_wrapper(1).$cmd.' . "\"$padding\"" . '.$args.&make_deferred_wrapper(0),$_)}' . "\n"; + +==> c302 <== +use strict; +use warnings; + +use Params::Validate qw(:all); + +use PVTests; +use Test::More 0.88; +my $String = 'foo'; # blank after this opens and closes + +my $Foo = bless \$v1, 'Foo'; +my $Bar = bless \$v2, 'Bar'; +my $Baz = bless \$v3, 'Baz'; +my $Quux = bless \$v4, 'Quux'; +my $v1; +my ( $v1, $v2, $v3, $v4 ); + diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 18d43728..4af869e8 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -15681,6 +15681,15 @@ EOM return $rhash_of_desires if ( !$ok ); + # The following parameter combination can be unstable (c302): + if ( $rOpts_kgb_size_max + && $rOpts_kgb_after == INSERT + && $rOpts_kgb_before == DELETE ) + { + # We reset kgb_before=STABLE to fix and continue + $rOpts_kgb_before = STABLE; + } + return; } ## end sub kgb_initialize_options