From 108cc9591423246e39b8e7e1bdb24f2df0b766a3 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Mon, 3 Oct 2022 12:06:10 -0700 Subject: [PATCH] fix issue b1378 --- dev-bin/run_convergence_tests.pl.data | 12 ++++++++++++ lib/Perl/Tidy/FileWriter.pm | 4 +++- lib/Perl/Tidy/Formatter.pm | 2 +- lib/Perl/Tidy/VerticalAligner.pm | 6 +++++- 4 files changed, 21 insertions(+), 3 deletions(-) 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, -- 2.39.5