]> git.donarmstrong.com Git - perltidy.git/commitdiff
Simplified the definition of lists for formatting purposes
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 27 Jan 2021 14:50:31 +0000 (06:50 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 27 Jan 2021 14:50:31 +0000 (06:50 -0800)
lib/Perl/Tidy/Formatter.pm

index 55071c0225bf33b1dd1b96680c176d2b2a501f80..fd7162016148ccb7967bd86fa4b11161a38282bd 100644 (file)
@@ -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;
         }
     }