From: Steve Hancock Date: Wed, 27 Sep 2023 21:57:11 +0000 (-0700) Subject: improve accuracy of guessed old indentation level in a .LOG file X-Git-Tag: 20230912.02~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0bf93aa8ddfc606891f04cdcc4fd289b59a5fc4e;p=perltidy.git improve accuracy of guessed old indentation level in a .LOG file --- diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 572523d6..5fb6e78a 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -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) {