From 83fe32f62f7888abaa7b823db0330fd23a0a59d2 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Mon, 2 Oct 2023 09:39:45 -0700 Subject: [PATCH] fix c283 --- lib/Perl/Tidy/Tokenizer.pm | 3 +++ 1 file changed, 3 insertions(+) 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; -- 2.39.5