From: Steve Hancock Date: Mon, 2 Oct 2023 16:39:45 +0000 (-0700) Subject: fix c283 X-Git-Tag: 20230912.03~11 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=83fe32f62f7888abaa7b823db0330fd23a0a59d2;p=perltidy.git fix c283 --- diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 726b9dfa..364a0e9c 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -653,6 +653,9 @@ EOM # Get trimmed lines. It is much faster to strip leading whitespace from # the whole input file at once than line-by-line. + # Add a terminal newline if needed to keep line count unchanged (c283) + if ( $source_string !~ /\n$/ ) { $source_string .= "\n" } + # Remove leading whitespace except newlines $source_string =~ s/^ [^\S\n]+ //gxm;