]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1307-9; check -issl flag when measuring one line blocks
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 15 Jan 2022 15:24:00 +0000 (07:24 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 15 Jan 2022 15:24:00 +0000 (07:24 -0800)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 3d4c01cab84c380d4052e196376bfe768fc9ab74..26f2c9c12e19189a1302da37f6b9b0f8f3371b89 100644 (file)
@@ -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" ) )
index c21014416bf24696674cd5aecad522ce20ebdaea..7716021e562d580d2b0a2d9f615e839c02a97e18 100644 (file)
@@ -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;