]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix c375
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 11 Jun 2024 20:07:06 +0000 (13:07 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 11 Jun 2024 20:07:06 +0000 (13:07 -0700)
lib/Perl/Tidy/VerticalAligner.pm

index b7f8da4995b3339b7634818de1393c85d1e0a07e..79236b5fcc09c86695e77a9fa2add92e35bc618a 100644 (file)
@@ -5526,9 +5526,15 @@ sub pad_signed_number_columns {
                 my $old_col   = $columns[$jcol];
                 my $col       = $alignment->{column};
 
-                # only do this if the text has a leading digit
-                if (   $col < $old_col
-                    && $rfields->[$jcol] =~ /^[+-]?\d/ )
+                if (
+                    $col < $old_col
+
+                    # only do this if the text has a leading digit
+                    && $rfields->[$jcol] =~ /^([+-]?)\d/
+
+                    # and a signed number has been seen - issue c375
+                    && ( $1 || $column_info{$jcol}->{signed_count} )
+                  )
                 {
                     my $spaces_needed = $old_col - $col;
                     my $spaces_available =