From 146b3d908b37efd71f512e0d68f1c76fca34cd19 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Wed, 27 Jan 2021 06:50:31 -0800 Subject: [PATCH] Simplified the definition of lists for formatting purposes --- lib/Perl/Tidy/Formatter.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 55071c02..fd716201 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -5670,12 +5670,18 @@ sub respace_tokens { next if ($block_type); my $rtype_count = $rtype_count_by_seqno->{$seqno}; next unless ($rtype_count); - my $fat_comma_count = $rtype_count->{'=>'}; + ##my $fat_comma_count = $rtype_count->{'=>'}; my $comma_count = $rtype_count->{','}; my $semicolon_count = $rtype_count->{';'}; - # This definition of a list is sufficient for our needs - if ( ( $fat_comma_count || $comma_count ) && !$semicolon_count ) { + # We will define a list to be a container with one or more commas and + # no semicolons. Previously we allowed either a comma or fat comma, + # but requiring a comma gives a guarantee later routines that there + # is a good line break point within the list. This is useful because + # we are mainly concerned with formatting and vertically aligning + # multiple-line lists here. + ##if ( ( $fat_comma_count || $comma_count ) && !$semicolon_count ) { + if ( $comma_count && !$semicolon_count ) { $ris_list_by_seqno->{$seqno} = $seqno; } } -- 2.39.5