]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix issue b1345
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 20 May 2022 18:15:33 +0000 (11:15 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 20 May 2022 18:15:33 +0000 (11:15 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 7fe52c3ae68ca26506d9671d7f31593f4bdc0b90..26abfd7f28ddc662280dd897db8abfa2b6492435 100644 (file)
@@ -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 ] ;
index 474af974167dc68fe267725f3700c0f6400d7b8f..ff76fc0e752ff541f92573e1bcdb8963c364d386 100644 (file)
@@ -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;
                             }