From 6d5ba9c3431ce33e9a76b2cff835c2fe623e8d8c Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Mon, 3 Jun 2019 17:48:25 -0700 Subject: [PATCH] fix cuddled else with sort,map,grep --- lib/Perl/Tidy/Formatter.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 ); } } -- 2.39.5