From: Steve Hancock Date: Mon, 3 Oct 2022 19:06:10 +0000 (-0700) Subject: fix issue b1378 X-Git-Tag: 20220613.06~13 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=108cc9591423246e39b8e7e1bdb24f2df0b766a3;p=perltidy.git fix issue b1378 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 29ceacdc..70dd2b34 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -10180,6 +10180,18 @@ $font_size --space-keyword-paren --weld-nested-containers +==> b1378.in <== + if($biblio->{subtitle}) + { &newsubtitle( + $biblionumber, + $biblio + ->{subtitle} + ,); + } + +==> b1378.par <== +-extrude -vtc=2 -dtc=1 + ==> b140.in <== $cmd[ $i ]=[ $s, $e, $cmd, \@hunk, $i ] ; diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index 2fd1c32d..e5778166 100644 --- a/lib/Perl/Tidy/FileWriter.pm +++ b/lib/Perl/Tidy/FileWriter.pm @@ -300,9 +300,11 @@ $str This is probably due to a recent programming change and needs to be fixed. EOM + # Always die during development, this needs to be fixed if (DEVEL_MODE) { Fault($msg) } - $self->warning($msg); + # Otherwise warn if string is not empty (added for b1378) + $self->warning($msg) if ( length($str) ); # Only issue this warning once $self->[_K_sequence_error_msg_] = $msg; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 3b25c6c2..0eaf3432 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -16039,7 +16039,7 @@ EOM $summed_lengths_to_go[ $_ + 1 ] -= $len; } - # Keep count tokens deleted by this sub because + # Count tokens deleted by this sub because # we have to turn off the simple convergence test # if there are deletions. This is because they are # at the end of formatting and may cause a formatting diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index b536a0db..0859fdc0 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -5286,7 +5286,11 @@ sub get_output_line_number { # write or cache this line ... # fix for case b999: do not cache an outdented line - if ( !$open_or_close || $side_comment_length > 0 || $is_outdented_line ) + # fix for b1378: do not cache an empty line + if ( !$open_or_close + || $side_comment_length > 0 + || $is_outdented_line + || !$line_length ) { $self->valign_output_step_C( $seqno_string,