From: Steve Hancock Date: Mon, 21 Jan 2019 15:47:46 +0000 (-0800) Subject: update comments on recent changes X-Git-Tag: 20190601~19 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ebcff71cb3646a3e41e7e4b79d5febee7ee5be02;p=perltidy.git update comments on recent changes --- diff --git a/CHANGES.md b/CHANGES.md index bc5745ad..10e35228 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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* @@ -24,6 +41,10 @@ - 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 diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index a82aa887..54a3dc20 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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; }