From: Steve Hancock Date: Sat, 25 Apr 2020 14:35:39 +0000 (-0700) Subject: fixed -tbc (was outputting extra lines) and -tsc (did not work) X-Git-Tag: 20200619~67 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=48790288af6683e3239e18784fd2c8372947b2ef;p=perltidy.git fixed -tbc (was outputting extra lines) and -tsc (did not work) --- diff --git a/bin/perltidy b/bin/perltidy index 94b02dfb..ecb90cb8 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -3245,7 +3245,7 @@ The command B<-dp> or B<--delete-pod> will remove all pod documentation Two commands which remove comments (but not pod) are: B<-dbc> or B<--delete-block-comments> and B<-dsc> or B<--delete-side-comments>. -(Hanging side comments will be deleted with block comments here.) +(Hanging side comments will be deleted with side comments here.) The negatives of these commands also work, and are the defaults. When block comments are deleted, any leading 'hash-bang' will be retained. @@ -3266,7 +3266,7 @@ not comments). The commands which write comments (but not pod) are: B<-tbc> or B<--tee-block-comments> and B<-tsc> or B<--tee-side-comments>. -(Hanging side comments will be written with block comments here.) +(Hanging side comments will be written with side comments here.) The negatives of these commands also work, and are the defaults. diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 069e31a4..b72af342 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -1560,6 +1560,9 @@ sub break_lines { { $self->want_blank_line(); } + if ( $rOpts->{'tee-pod'} ) { + $sink_object->write_tee_line($input_line); + } } # leave the blank counters in a predictable state @@ -1573,10 +1576,6 @@ sub break_lines { if ( !$skip_line ) { $self->write_unindented_line($input_line); } - - if ( $rOpts->{'tee-pod'} ) { - $sink_object->write_tee_line($input_line); - } } } return; @@ -7192,6 +7191,7 @@ sub copy_token_as_type { my $rLL = $self->{rLL}; my $rbreak_container = $self->{rbreak_container}; my $rshort_nested = $self->{rshort_nested}; + my $sink_object = $self->{sink_object}; my $rOpts_add_newlines = $rOpts->{'add-newlines'}; my $rOpts_break_at_old_comma_breakpoints = @@ -7254,7 +7254,7 @@ sub copy_token_as_type { if ($is_comment) { if ( $rOpts->{'tee-block-comments'} ) { - $file_writer_object->tee_on(); + $sink_object->write_tee_line($input_line); } destroy_one_line_block(); @@ -7303,9 +7303,6 @@ sub copy_token_as_type { $rtok_first->[_TOKEN_] . "\n" ); $last_line_leading_type = '#'; } - if ( $rOpts->{'tee-block-comments'} ) { - $file_writer_object->tee_off(); - } return; } @@ -7814,6 +7811,10 @@ sub copy_token_as_type { my $type = $rLL->[$K_last]->[_TYPE_]; + if ( $type eq '#' && $rOpts->{'tee-side-comments'} ) { + $sink_object->write_tee_line($input_line); + } + # we have to flush .. if (