From: Steve Hancock Date: Thu, 15 Feb 2024 02:57:41 +0000 (-0800) Subject: minor -vsn improvements X-Git-Tag: 20240202.02~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3ea82bfe831dcecb29ab92b7aee05555584d7363;p=perltidy.git minor -vsn improvements --- diff --git a/CHANGES.md b/CHANGES.md index d94ae8f8..4ecc53fc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,17 +5,14 @@ - The option --delete-repeated-commas is now the default. It makes the following checks and changes: - - Repeated commas like ',,' on the same line are removed with a warning - - Repeated fat commas like '=> =>' on the same line are removed with a + - Repeated commas like ',,' are removed with a warning + - Repeated fat commas like '=> =>' are removed with a warning - - Repeated commas and fat commas on different lines remain unchanged but - produce a warning (to avoid promoting a side-comment to block comment) - - The combination '=>,' produces a warning but is not changed (it is - likely an error but only its author would know how to fix it). - These warnings are only output if the --warning-output, -w flag is set. + - The combination '=>,' produces a warning but is not changed + These warnings are only output if --warning-output, or -w, is set. This is now the DEFAULT Behavior. - To avoid this change, use --nodelete-repeated-commas, or -ndrc. + Use --nodelete-repeated-commas, or -ndrc, to turn this option off. - Added control --delete-interbracket-arrows, or -dia, to delete optional hash ref and array ref arrows between brackets as in the following diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index b2176074..8538b2e3 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -5013,15 +5013,11 @@ EOM $is_single_col = $jmax == 1; } - # Skip padding in a large table, or single column, where 'most' - # of the signed values are shorter than the unsigned values. - # The median is used to make this insensitive to small changes. - if ( $median_unsigned_length >= $median_signed_length ) { - if ( $is_single_col - || $nlines > $rOpts_valign_signed_numbers_limit / 2 ) - { - return; - } + # Skip padding in a table where 'most' of the signed values are shorter + # than the unsigned values. Require at least 3 unsigned values for this + # test to reduce the influence of the min and max values + if ( $median_unsigned_length >= $median_signed_length && $unsigned > 2 ) { + return; } #-------------------------------------- diff --git a/t/snippets/expect/vsn.vsn1 b/t/snippets/expect/vsn.vsn1 index 026a3c27..c196ac47 100644 --- a/t/snippets/expect/vsn.vsn1 +++ b/t/snippets/expect/vsn.vsn1 @@ -1,9 +1,9 @@ @data = ( ["1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th"], - [ 1, 2, 5, 6, 3, 1.5, -1, -3, -4], + [ 1, 2, 5, 6, 3, 1.5, -1, -3, -4], [-4, -3, 1, 1, -3, -1.5, -2, -1, 0], - [ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3], - [ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4], + [ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3], + [ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4], ); $s->drawLine( 35, 0); diff --git a/t/snippets29.t b/t/snippets29.t index 64c55bd2..129aed1a 100644 --- a/t/snippets29.t +++ b/t/snippets29.t @@ -128,10 +128,10 @@ $s->drawLine( 0, -10 ); expect => <<'#3...........', @data = ( ["1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th"], - [ 1, 2, 5, 6, 3, 1.5, -1, -3, -4], + [ 1, 2, 5, 6, 3, 1.5, -1, -3, -4], [-4, -3, 1, 1, -3, -1.5, -2, -1, 0], - [ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3], - [ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4], + [ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3], + [ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4], ); $s->drawLine( 35, 0);