]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix problem causing failure of test case sub3.def
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 12 May 2020 14:14:16 +0000 (07:14 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 12 May 2020 14:14:16 +0000 (07:14 -0700)
lib/Perl/Tidy/Formatter.pm

index b41896cc2482448dc0a5a6f28e9d59b1e8c6b235..e086687529b06a37f19ace26e620f2a77149ee5e 100644 (file)
@@ -7430,7 +7430,7 @@ sub copy_token_as_type {
             # Fix for rt #125506 Unexpected string formating
             # in which leading space of a terminal quote was removed
             $line =~ s/\s+$//;
-            $line =~ s/^\s+// unless ($in_continued_quote);
+            $line =~ s/^\s+// unless ( $line_of_tokens->{_starting_in_quote} );
 
             my $Ktoken_vars = $K_first;
 
@@ -8384,7 +8384,10 @@ sub starting_one_line_block {
     }
 
     # find the starting keyword for this block (such as 'if', 'else', ...)
-    if ( $block_type =~ /^[\{\}\;\:]$/ || $block_type =~ /^package/ ) {
+    if (   $max_index_to_go == 0
+        || $block_type =~ /^[\{\}\;\:]$/
+        || $block_type =~ /^package/ )
+    {
         $i_start = $max_index_to_go;
     }