From: Steve Hancock Date: Thu, 2 Nov 2023 01:56:14 +0000 (-0700) Subject: check for negative -i and -ci X-Git-Tag: 20230912.05~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=35104c510ca1d048d2d5ec3283d0048564552a7e;p=perltidy.git check for negative -i and -ci --- diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 70c6e35d..a97470e1 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -4554,6 +4554,16 @@ sub check_options { EOM } + # do not allow negative --indent-columns + if ( $rOpts->{'indent-columns'} < 0 ) { + $rOpts->{'indent-columns'} = 0; + } + + # negative ci is currently allowed provided that ci+i is not negative + if ( $rOpts->{'continuation-indentation'} < -$rOpts->{'indent-columns'} ) { + $rOpts->{'continuation-indentation'} = -$rOpts->{'indent-columns'}; + } + my $sil = $rOpts->{'starting-indentation-level'}; if ( defined($sil) && $sil < 0 ) { Die(< 0 ) + { $spaces += $rOpts_continuation_indentation; } }