From c16c5eedf356cd020039516765ad15a2526d8ec6 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sat, 20 Feb 2021 04:46:45 -0800 Subject: [PATCH] Limit the value of -ci=n to that of -i=n when -xci is set --- lib/Perl/Tidy/Formatter.pm | 10 ++++++++++ local-docs/BugLog.pod | 17 +++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 7f5c7073..066e87a7 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -1049,6 +1049,16 @@ sub check_options { Exit(0); } + # Do not let the value of -ci exceed the value of -i if -xci is set. This + # can lead to blinking states. Silently reduce the -ci value to -i if this + # occurs. Fixes b707 b770 b912 b920 b930 b933 b939 b940 b941 b942 b978 + if ( $rOpts->{'continuation-indentation'} > $rOpts->{'indent-columns'} + && $rOpts->{'extended-continuation-indentation'} ) + { + $rOpts->{'continuation-indentation'} = $rOpts->{'indent-columns'}; + } + + if ( $rOpts->{'line-up-parentheses'} ) { if ( $rOpts->{'indent-only'} diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index bb870608..bc611439 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,19 @@ =over 4 +=item B + +Testing with random input parameters produced a number of oscillating states +which had both parameter -xci as well as a value of -ci=n which exceeded the +value of -i=n. To correct this, perltidy will silently reduce the -ci value to +the -i value when -xci is also set. This should not change existing formatting +because a value of -ci greater than -i would not normally be used in practice. + +These cases are fixed with this update: +b707 b770 b912 b920 b930 b933 b939 b940 b941 b942 b978 b974 b979 b980 b981 + +20 Feb 2021. + =item B Several cases of alternating states were produced in random testing which @@ -17,12 +30,12 @@ This fixes cases b654 b655 b943 b944 b967 b968 b969 b970. The update of 13 Feb 2021, cf414fe, has been modified to be less restrictive. Space between a binary plus and minus and a bareword may now be removed in some cases where no tokenization ambiguity exists. -18 Feb 2021. +18 Feb 2021, a8564c8. =item B This update fixes cases b899 b935. -17 Feb 2021. +17 Feb 2021, b955a7c. =item B -- 2.39.5