]> git.donarmstrong.com Git - perltidy.git/commitdiff
fixed -tbc (was outputting extra lines) and -tsc (did not work)
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 25 Apr 2020 14:35:39 +0000 (07:35 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 25 Apr 2020 14:35:39 +0000 (07:35 -0700)
bin/perltidy
lib/Perl/Tidy/Formatter.pm

index 94b02dfb152cbd053beac4f7692ffb060ddc9507..ecb90cb8a3f16831b873f40045d694f31fe4b00d 100755 (executable)
@@ -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.  
 
index 069e31a45b86c8eed227add917ac1998a979a425..b72af3423be0c2f3a5d87e4acdd509dfd8a9fc5d 100644 (file)
@@ -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 (