]> git.donarmstrong.com Git - perltidy.git/commitdiff
improve accuracy of guessed old indentation level in a .LOG file
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 27 Sep 2023 21:57:11 +0000 (14:57 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 27 Sep 2023 21:57:11 +0000 (14:57 -0700)
lib/Perl/Tidy/Tokenizer.pm

index 572523d6202f42e1be446fe448d29d4179bbe431..5fb6e78aaf57ea3e5ce2f393f682297af0b64db0 100644 (file)
@@ -5263,21 +5263,11 @@ EOM
                     # Trim the line
                     $input_line = substr( $input_line, $spaces );
 
-                    # defined 'guessed_indentation_level' if logfile to be saved
+                    # set 'guessed_indentation_level' if logfile to be saved
                     if ( $self->[_save_logfile_] ) {
-
-                        # Find actual space count if there are leading tabs
-                        if (
-                            ord( substr( $untrimmed_input_line, 0, 1 ) ) ==
-                            ORD_TAB
-                            && $untrimmed_input_line =~ /^(\t+)/ )
-                        {
-                            $spaces += length($1) * ( $tabsize - 1 );
-                        }
-
-                        # Calculate a guessed level for nonblank lines to avoid
-                        $line_of_tokens->{_guessed_indentation_level} =
-                          int( $spaces / $rOpts_indent_columns );
+                        my $guess = $self->guess_old_indentation_level(
+                            $untrimmed_input_line);
+                        $line_of_tokens->{_guessed_indentation_level} = $guess;
                     }
                 }
                 elsif ($spaces) {