]> git.donarmstrong.com Git - perltidy.git/commitdiff
update comments on recent changes
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 21 Jan 2019 15:47:46 +0000 (07:47 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 21 Jan 2019 15:47:46 +0000 (07:47 -0800)
CHANGES.md
lib/Perl/Tidy/Formatter.pm

index bc5745ad8fac87742e2cdd26f35b893ae2d6702c..10e352285ec5c550e5c0d155cbe7cc729b07c9ae 100644 (file)
@@ -2,8 +2,25 @@
 
 ## 2018 11 20.01
 
+    - RT #128216, very minor update to prevent inserting unwanted blank line at
+      indentation level change.  This should not change existing scripts.
+
     - RT #81852: Improved indentation when quoted word (qw) lists are 
       nested within other containers using the --weld-nested (-wn) flag.
+      The example given previously (below) is now closer to what it would
+      be with a simple list instead of qw:
+
+      # perltidy -wn
+      use_all_ok( qw{
+          PPI
+          PPI::Tokenizer
+          PPI::Lexer
+          PPI::Dumper
+          PPI::Find
+          PPI::Normal
+          PPI::Util
+          PPI::Cache
+      } );
 
     - RT#12764, introduced new feature allowing placement of blanks around
       sequences of selected keywords. This can be activated with the -kgb* 
 
     - Add repository URLs to META files 
 
+    - RT #118553, "leave only one newline at end of file". This option was not 
+      added because of undesirable side effects, but a new filter script
+      was added which can do this, "examples/delete_ending_blank_lines.pl".  
+
 ## 2018 11 20
 
     - fix RT#127736 Perl-Tidy-20181119 has the EXE_FILES entry commented out in
index a82aa88771d61f76889a70e764fb47c390451ffe..54a3dc2004e8cc067694a857f8db7e1c836d2ad0 100644 (file)
@@ -1458,19 +1458,25 @@ sub break_lines {
     my $self   = shift;
     my $rlines = $self->{rlines};
 
-    # TESTING: trim ending blank lines.  Works but flag not yet implemented.
-    my $Opt_trim_ending_blank_lines = 0;
-    if ($Opt_trim_ending_blank_lines) {
-        while ( my $line_of_tokens = pop @{$rlines} ) {
-            my $line_type = $line_of_tokens->{_line_type};
-            if ( $line_type eq 'CODE' ) {
-                my $CODE_type = $line_of_tokens->{_code_type};
-                next if ( $CODE_type eq 'BL' );
-            }
-            push @{$rlines}, $line_of_tokens;
-            last;
-        }
-    }
+    # Note for RT#118553, leave only one newline at the end of a file.
+    # Example code to do this is in comments below:
+    # my $Opt_trim_ending_blank_lines = 0;
+    # if ($Opt_trim_ending_blank_lines) {
+    #     while ( my $line_of_tokens = pop @{$rlines} ) {
+    #         my $line_type = $line_of_tokens->{_line_type};
+    #         if ( $line_type eq 'CODE' ) {
+    #             my $CODE_type = $line_of_tokens->{_code_type};
+    #             next if ( $CODE_type eq 'BL' );
+    #         }
+    #         push @{$rlines}, $line_of_tokens;
+    #         last;
+    #     }
+    # }
+
+    # But while this would be a trivial update, it would have very undesirable
+    # side effects when perltidy is run from within an editor on a small snippet.
+    # So this is best done with a separate filter, such 
+    # as 'delete_ending_blank_lines.pl' in the examples folder.  
 
     # Flag to prevent blank lines when POD occurs in a format skipping sect.
     my $in_format_skipping_section;
@@ -7668,7 +7674,7 @@ sub output_line_to_go {
                 my $lc = $nonblank_lines_at_depth[$last_line_leading_level];
                 if ( !defined($lc) ) { $lc = 0 }
 
-               # TESTING patch for RT #128216 
+               # patch for RT #128216: no blank line inserted at a level change
                 if ( $levels_to_go[$imin] != $last_line_leading_level ) {
                     $lc = 0;
                 }