]> git.donarmstrong.com Git - perltidy.git/commitdiff
optimize logical padding
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 25 Sep 2021 16:43:31 +0000 (09:43 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 25 Sep 2021 16:43:31 +0000 (09:43 -0700)
bin/perltidy
lib/Perl/Tidy/Formatter.pm

index d54eb58777151fba94058af70279435ac04f81ed..6045f3cafbd6326fe04a107fa1cad97c52ec3b38 100755 (executable)
@@ -3909,6 +3909,7 @@ to include it separately.
 There are a few points to note regarding one-line blocks.  A one-line
 block is something like this,
 
+    if ( -e $file ) { print "'$file' exists\n" }
 
 where the contents within the curly braces is short enough to fit
 on a single line.
index 702c91e6424c2ffe92a57b77113bfb8642596cb8..177df1f126f9a1519b2ce461e3716bffbbc81cbb 100644 (file)
@@ -167,6 +167,7 @@ my (
     $rOpts_indent_only,
     $rOpts_keep_interior_semicolons,
     $rOpts_line_up_parentheses,
+    $rOpts_logical_padding,
     $rOpts_maximum_consecutive_blank_lines,
     $rOpts_maximum_fields_per_table,
     $rOpts_maximum_line_length,
@@ -1656,6 +1657,7 @@ EOM
     $rOpts_indent_only              = $rOpts->{'indent-only'};
     $rOpts_keep_interior_semicolons = $rOpts->{'keep-interior-semicolons'};
     $rOpts_line_up_parentheses      = $rOpts->{'line-up-parentheses'};
+    $rOpts_logical_padding          = $rOpts->{'logical-padding'};
     $rOpts_maximum_consecutive_blank_lines =
       $rOpts->{'maximum-consecutive-blank-lines'};
     $rOpts_maximum_fields_per_table  = $rOpts->{'maximum-fields-per-table'};
@@ -19805,7 +19807,7 @@ sub send_lines_to_vertical_aligner {
 
     $self->set_logical_padding( $ri_first, $ri_last, $peak_batch_size,
         $starting_in_quote )
-      if ( !$is_block_comment && $rOpts->{'logical-padding'} );
+      if ( $n_last_line > 0 && $rOpts_logical_padding );
 
     # Resum lengths. We need accurate lengths for making alignment patterns,
     # and we may have unmasked a semicolon which was not included at the start.