From: Steve Hancock Date: Sat, 15 Jan 2022 15:24:00 +0000 (-0800) Subject: fix b1307-9; check -issl flag when measuring one line blocks X-Git-Tag: 20211029.06~19 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=966324fd7660336d893da36be94c9fa5f7dfb983;p=perltidy.git fix b1307-9; check -issl flag when measuring one line blocks --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 3d4c01ca..26f2c9c1 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -9212,6 +9212,25 @@ $oreo = cookie( --maximum-line-length=35 --variable-maximum-line-length +==> b1307.in <== +if ( ) { } + +else { + } # + +if ( ) { } + +else +{ } # + + +==> b1307.par <== +--block-brace-vertical-tightness=2 +--ignore-side-comment-lengths +--indent-closing-brace +--maximum-line-length=8 +--opening-brace-on-new-line + ==> b131.in <== unless ( open( SCORE, "+>>$Score_File" ) ) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index c2101441..7716021e 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -12773,10 +12773,12 @@ EOM if ( $index_start_one_line_block != UNDEFINED_INDEX ) { # Fix for b1208: if a side comment follows this closing - # brace then we must include its length in the length test. + # brace then we must include its length in the length test + # ... unless the -issl flag is set (fixes b1307-1309). # Assume a minimum of 1 blank space to the comment. my $added_length = $side_comment_follows + && !$rOpts_ignore_side_comment_lengths ? 1 + $rLL->[$Knnb]->[_TOKEN_LENGTH_] : 0;