From: Steve Hancock Date: Tue, 4 Jun 2019 00:48:25 +0000 (-0700) Subject: fix cuddled else with sort,map,grep X-Git-Tag: 20190915~21 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6d5ba9c3431ce33e9a76b2cff835c2fe623e8d8c;p=perltidy.git fix cuddled else with sort,map,grep --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 80b5580f..a91ec208 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -8116,8 +8116,15 @@ sub starting_one_line_block { if ( $is_sort_map_grep_eval{$block_type} ) { # Patch for issue git#9: do not try to form new one line blocks for a - # cuddled block type. For example, for flags -ce and -cbl='map,sort,grep' - if ( !$rcuddled_block_types->{'*'}->{$block_type} ) { + # cuddled block type. For example, for flags -ce and + # -cbl='map,sort,grep' + if ( $rOpts->{'cuddled-else'} + && %$rcuddled_block_types + && $rcuddled_block_types->{'*'}->{$block_type} ) + { + # this is a cuddled type + } + else { create_one_line_block( $i_start, 1 ); } }