From a58ab659c32fef6573583e6010e4d0d0697f3ca1 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 28 Oct 2022 18:23:03 -0700 Subject: [PATCH] fix b1399 --- dev-bin/run_convergence_tests.pl.data | 43 +++++++++++++++++++++++++++ lib/Perl/Tidy/Formatter.pm | 19 ++++++++---- 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 6f59edbd..24571afb 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -10524,6 +10524,49 @@ SOAP::Transport::HTTP::Daemon->new (LocalAddr => $host, --maximum-line-length=92 --space-keyword-paren +==> b1399.in <== +use constant GRAPH_SIZE => 100; +for ( my $i = 0 ; + $i < @$data ; + $i++ ) + { + $polygon->addPt( + ORIGIN_X_COORD + + GRAPH_SIZE + / ( @$data - 1 ) + * $i, + ORIGIN_Y_COORD + - $$data[$i] + * GRAPH_SIZE + / LOAD_MAX + ); + } ## end for ( my $i = 0; $i < ...) + +for ( my $i = 0 ; + $i < @$data ; + $i++ ) + { + $polygon->addPt( + ORIGIN_X_COORD + + GRAPH_SIZE + / ( @$data - 1 ) + * $i, + ORIGIN_Y_COORD + - $$data[$i] + * GRAPH_SIZE / LOAD_MAX, + ); + } ## end for ( my $i = 0; $i < ...) + +==> b1399.par <== +--line-up-parentheses +--maximum-line-length=33 +--keep-old-breakpoints-before='-' +--variable-maximum-line-length +--indent-columns=5 +--break-before-all-operators +--break-at-old-comma-breakpoints +--brace-left-and-indent + ==> b140.in <== $cmd[ $i ]=[ $s, $e, $cmd, \@hunk, $i ] ; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 432e4c7b..e07c6e80 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -16448,6 +16448,7 @@ sub break_all_chain_tokens { # now look for any interior tokens of the same types $count = 0; + my $has_interior_dot_or_plus; for my $n ( 0 .. $nmax ) { my $il = $ri_left->[$n]; my $ir = $ri_right->[$n]; @@ -16459,21 +16460,27 @@ sub break_all_chain_tokens { if ( $saw_chain_type{$key} ) { push @{ $interior_chain_type{$key} }, $i; $count++; + $has_interior_dot_or_plus ||= ( $key eq '.' || $key eq '+' ); } } } return unless $count; + my @keys = keys %saw_chain_type; + + # quit if just ONE continuation line with leading . For example-- + # print LATEXFILE '\framebox{\parbox[c][' . $h . '][t]{' . $w . '}{' + # . $contents; + # Fixed for b1399. + if ( $has_interior_dot_or_plus && $nmax == 1 && @keys == 1 ) { + return; + } + # now make a list of all new break points my @insert_list; # loop over all chain types - foreach my $key ( keys %saw_chain_type ) { - - # quit if just ONE continuation line with leading . For example-- - # print LATEXFILE '\framebox{\parbox[c][' . $h . '][t]{' . $w . '}{' - # . $contents; - last if ( $nmax == 1 && $key =~ /^[\.\+]$/ ); + foreach my $key (@keys) { # loop over all interior chain tokens foreach my $itest ( @{ $interior_chain_type{$key} } ) { -- 2.39.5