From: Steve Hancock Date: Tue, 11 Oct 2022 22:02:29 +0000 (-0700) Subject: fix issue b1381 X-Git-Tag: 20220613.06~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8728d8c0ce2018dfe21d19f3f846bd2ea0ca2d57;p=perltidy.git fix issue b1381 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index bd8e73fe..e3cf6f1c 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -10221,6 +10221,30 @@ print star ( --variable-maximum-line-length --vertical-tightness-closing=2 +==> b1381.in <== +my $formatter = new HTML::FormatPS( + 'PaperSize' => 'Letter', 'LeftMargin' => 20, # in points + 'RightMargin' => 20, # ditto + 'TopMargin' => 10, 'BottomMargin' => 30, + 'FontFamily' => 'Helvetica', ); + +my $formatter = new HTML::FormatPS( + 'PaperSize' => 'Letter', 'LeftMargin' => 20, # in points + 'RightMargin' => 20, # ditto + 'TopMargin' => 10, 'BottomMargin' => 30, 'FontFamily' => 'Helvetica' +); + +==> b1381.par <== +--add-trailing-commas +--comma-arrow-breakpoints=3 +--delete-trailing-commas +--extended-continuation-indentation +--ignore-old-breakpoints +--maximum-line-length=70 +--paren-vertical-tightness-closing=1 +--want-trailing-commas='b' +--variable-maximum-line-length + ==> b140.in <== $cmd[ $i ]=[ $s, $e, $cmd, \@hunk, $i ] ; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 4ecdade2..38f3aea9 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -8101,8 +8101,9 @@ sub match_trailing_comma_rule { $rLL_new ); } - # Fix for b1379, b1380, part 1. Mark bare trailing commas for use by -vtc - # logic to avoid instability when -dtc and -atc are both active. + # Fix for b1379, b1380, b1381, b1382 part 1. Mark bare trailing commas for + # use by -vtc logic to avoid instability when -dtc and -atc are both + # active. if ( $match && ( $trailing_comma_style eq 'b' || $trailing_comma_style eq 'h' ) ) { @@ -27500,13 +27501,14 @@ sub set_vertical_tightness_flags { $cvt = 1; } - # Fix for b1379, b1380, part 2. In some rare cases, -cvt=2 can be - # unstable with adding and deleting trailing bare commas. - # Reducing to -cvt=1 seems to restore stability. - if ( $cvt == 2 + # Fix for b1379, b1380, b1381, b1382 part 2. + # Instablility with adding and deleting trailing bare commas. + # Reducing -cvt=2 to -cvt=1 fixes stability in b1379, b1380. + # Reducing -cvt>0 to -cvt=0 fixes stability in b1381, b1382. + if ( $cvt && $self->[_ris_bare_trailing_comma_by_seqno_]->{$seqno} ) { - $cvt = 1; + $cvt = 0; } if (