From: Steve Hancock Date: Sat, 27 Feb 2021 13:58:11 +0000 (-0800) Subject: Avoid double spaces in -csc text output X-Git-Tag: 20210402~30 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b22e891617bf221960e8de17943d83b6f6c5eb7d;p=perltidy.git Avoid double spaces in -csc text output --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index ec58708e..c51825af 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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]; diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 7cdc9ab6..73c479b8 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,44 @@ =over 4 +=item B + +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 Random testing produced an unstable state when a debug flag, -nfll, was set.