]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fix some rare issues with the -lp option
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 3 May 2021 02:43:48 +0000 (19:43 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 3 May 2021 02:43:48 +0000 (19:43 -0700)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index 6bd766f92a2a2c597bd3e894c8cf2bedda5a3cfb..4ad58f2c7764c002ab3a9694d5c1d02780a0647c 100644 (file)
@@ -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);
             }
         }
index b4ce52a1de0ec29aa44025bac4f7c58ea51dfd41..efbe2b9f97961435a390a4a8cdfc5a95ac63bf1f 100644 (file)
@@ -2,6 +2,14 @@
 
 =over 4
 
+=item B<Fix some rare issues with the -lp option>
+
+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<Correct brace types mismarked by tokenizer>
 
 This is a generalization of commit 7d23bf4 to fix some additional cases