]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1496
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 30 Oct 2024 00:07:14 +0000 (17:07 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 30 Oct 2024 00:07:14 +0000 (17:07 -0700)
dev-bin/run_convergence_tests.pl.data
dev-bin/run_convergence_tests.pl.expect
lib/Perl/Tidy/Formatter.pm

index f4f168294154cce4cf322a2f73f564bf7e2d0619..4f7da854be607889ec7510de3c37c9e0b020daf8 100644 (file)
@@ -12390,6 +12390,24 @@ $e_str->bind ( '<return>' => sub {$e_hnr->tabfocus if $e_hnr->can ( 'tabfocus' )
 --want-trailing-commas='h'
 --delete-trailing-commas
 
+==> b1496.in <==
+my @abc
+     = qw( a b c d e
+     );
+
+my @abc = qw(
+a b c d e );
+
+==> b1496.par <==
+--maximum-line-length=21
+--indent-columns=0
+--continuation-indentation=5
+--line-up-parentheses
+--break-before-all-operators
+--novalign-code
+--break-at-trailing-comma-types='i'
+--qw-as-function
+
 ==> b156.in <==
 # State 1
 {
index 359b58c78c3aa1c9361d9c13c9ad626d4bb288e3..4ffb4ca59db563ab0e341bf73d3ed472348a7266 100644 (file)
@@ -8378,6 +8378,15 @@ $e_str->bind (
             '<1>' => sub { cset('D', 'HilightColorFore', "\$color"); }
         );
 
+==> b1496 <==
+my @abc
+     = qw( a b c d e
+     );
+
+my @abc
+     = qw( a b c d e
+     );
+
 ==> b156 <==
 # State 1
 {
index 2b66a3afa5ad33b3bd11481e7b9b39afeefbfbec..62232180de730a0ef43bf148f232845f3bb0c10a 100644 (file)
@@ -13981,9 +13981,11 @@ sub store_token {
                     }
 
                     # set flag to retain trailing comma breaks (b1493, c416)
+                    # length check needed to ignore phantom commas (b1496)
                     if (   $last_nonblank_code_type eq ','
                         && $trailing_comma_break_rules{$token}
-                        && $Ktoken_vars == $Kfirst_old )
+                        && $Ktoken_vars == $Kfirst_old
+                        && length($last_nonblank_code_token) )
                     {
                         $self->[_rbreak_container_]->{$type_sequence} = 1;
                     }