From: Steve Hancock Date: Mon, 3 May 2021 02:43:48 +0000 (-0700) Subject: Fix some rare issues with the -lp option X-Git-Tag: 20210402.01~57 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a8d1c8bb1400da9d1625ca4b65f4754e806b3e0d;p=perltidy.git Fix some rare issues with the -lp option --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 6bd766f9..4ad58f2c 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -5580,6 +5580,16 @@ sub respace_tokens { my $rcopy = copy_token_as_type( $rLL->[$Kfirst], 'b', ' ' ); $rcopy->[_LINE_INDEX_] = $rLL_new->[-1]->[_LINE_INDEX_]; + + # The level and ci_level of newly created spaces should be the + # same as the previous token. Otherwise blinking states can + # be created if the -lp mode is used. See similar coding in + # sub 'store_token_and_space'. Fixes cases b1109 b1110. + $rcopy->[_LEVEL_] = + $rLL_new->[-1]->[_LEVEL_]; + $rcopy->[_CI_LEVEL_] = + $rLL_new->[-1]->[_CI_LEVEL_]; + $store_token->($rcopy); } } diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index b4ce52a1..efbe2b9f 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,14 @@ =over 4 +=item B + +Random testing produced some rare cases of unstable formatting involving the +B<-lp> option which are fixed with this update. This is a generalization of +commit edc7878 of 23 Jan 2021. This fixes cases b1109 b1110. + +2 May 2021. + =item B This is a generalization of commit 7d23bf4 to fix some additional cases