From 240dfae2b4198309a7b1c73a690548e9680dcdc4 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 20 May 2022 11:15:33 -0700 Subject: [PATCH] fix issue b1345 --- dev-bin/run_convergence_tests.pl.data | 23 +++++++++++++++++++++++ lib/Perl/Tidy/Formatter.pm | 13 ++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 7fe52c3a..26abfd7f 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -9857,6 +9857,29 @@ print to_json({success => $success ? 1 : 0}); --paren-vertical-tightness=2 --weld-nested-containers +==> b1345.in <== +# S1 + $insert = [ + map { [ + _subnet_as_v6( $_->[ 0 ] ), $_->[ 1 ] ] } @{$insert} + ]; + +# S2 + $insert = [ + map { [ _subnet_as_v6( $_->[ 0 ] ), $_->[ 1 ] ] } + @{$insert} + ]; + +==> b1345.par <== +--continuation-indentation=5 +--extended-continuation-indentation +--extended-line-up-parentheses +--indent-columns=10 +--maximum-line-length=52 +--square-bracket-tightness=0 +--variable-maximum-line-length +--weld-nested-containers + ==> b140.in <== $cmd[ $i ]=[ $s, $e, $cmd, \@hunk, $i ] ; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 474af974..ff76fc0e 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -11255,7 +11255,8 @@ EOM #------------------------------------------ # Some test cases: # c098/x107 x108 x110 x112 x114 x115 x117 x118 x119 - if ( $rblock_type_of_seqno->{$seqno} ) { + my $block_type = $rblock_type_of_seqno->{$seqno}; + if ($block_type) { my $K_c = $KK; my $block_length = MIN_BLOCK_LEN; @@ -11281,9 +11282,15 @@ EOM # extremely long. We do not need to do a precise # check here, because if it breaks then it will # stay broken on later iterations. - elsif ($is_one_line_block + elsif ( + $is_one_line_block && $block_length < - $maximum_line_length_at_level[$level] ) + $maximum_line_length_at_level[$level] + + # But skip this for sort/map/grep/eval blocks + # because they can reform (b1345) + && !$is_sort_map_grep_eval{$block_type} + ) { $collapsed_len = $block_length; } -- 2.39.5