]> git.donarmstrong.com Git - perltidy.git/commitdiff
Avoid double spaces in -csc text output
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 27 Feb 2021 13:58:11 +0000 (05:58 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 27 Feb 2021 13:58:11 +0000 (05:58 -0800)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index ec58708e8bee52416cc0ec9d67f2d1952c0d65da..c51825afcc038ea6ce7b592d18b26a17ee91b48c 100644 (file)
@@ -20682,7 +20682,9 @@ sub set_vertical_tightness_flags {
             {
 
                 # add an extra space at each newline
-                if ( $i == 0 ) { $leading_block_text .= ' ' }
+                if ( $i == 0 && $types_to_go[$i] ne 'b' ) {
+                    $leading_block_text .= ' ';
+                }
 
                 # add the token text
                 $leading_block_text .= $tokens_to_go[$i];
index 7cdc9ab6136fe658b0c91813889a72a361eee3dc..73c479b858b949419cbb43838641747d3c4ea4f0 100644 (file)
@@ -2,6 +2,44 @@
 
 =over 4
 
+=item B<Avoid double spaces in -csc text output>
+
+Random testing produced some rare cases where two spaces could occur
+in -csc text.  This happened when there were multiple lines and the
+formatter placed a leading blank in one of the continuation lines
+as padding. This has been fixed.
+
+For example
+
+    while (
+        <>;
+      )
+    {
+       ...
+    } ## end while ( <>; )
+
+Previously, the last line had an extra space after the ';'
+
+    } ## end while ( <>;  )
+
+Another example
+
+    while (
+        do {
+            { package DB; @a = caller( $i++ ) }
+        }
+      )
+    {
+      ...
+    } ## end while ( do { { package DB...}})
+
+Previously the last line had an extra space between the opening braces:
+
+    } ## end while ( do {  { package DB...}})
+
+27 Feb 2021.
+
+
 =item B<Remove control of debug flag -fll>
 
 Random testing produced an unstable state when a debug flag, -nfll, was set.