]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix c283
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 2 Oct 2023 16:39:45 +0000 (09:39 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 2 Oct 2023 16:39:45 +0000 (09:39 -0700)
lib/Perl/Tidy/Tokenizer.pm

index 726b9dfa02111311ef07e400eb28c8a68ff83cb0..364a0e9cd159f7d6e4e30b334bd24929884135a6 100644 (file)
@@ -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;