]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix rare instability b1305 involving -bbxi>0 -naws and -ci>-i
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 7 Jan 2022 13:39:32 +0000 (05:39 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 7 Jan 2022 13:39:32 +0000 (05:39 -0800)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 1871c9687b8e8eb01bba01441dc2a90c661b8663..74556436ea417a112f07f59efdef8fde01ea53d3 100644 (file)
@@ -8964,6 +8964,34 @@ if (( $response = $browser->request($curreq)
 --line-up-parentheses
 --maximum-line-length=52
 
+==> b1305.in <==
+my %Map =(
+  File::Spec->catfile(
+    $Dir,"linktest_with_dir.tar"
+        ) =>
+    [
+    [   0, qr/SECURE EXTRACT MODE/],[ 1, qr/^$/ ]
+    ],
+);
+
+my %Map =(
+  File::Spec->catfile(
+    $Dir,"linktest_with_dir.tar"
+        ) =>
+        [
+    [   0, qr/SECURE EXTRACT MODE/],
+    [ 1, qr/^$/ ]
+        ],
+);
+
+==> b1305.par <==
+--noadd-whitespace
+--break-before-square-bracket-and-indent=2
+--break-before-square-bracket=1
+--continuation-indentation=6
+--indent-columns=2
+--maximum-line-length=53
+
 ==> b131.in <==
         unless
           ( open( SCORE, "+>>$Score_File" ) )
index 8c687eac6fb118ecf7ba765a1190aa162f9a6892..8d7a6145ddcbbf5d72d28f11da4391318b9d0c2e 100644 (file)
@@ -9944,6 +9944,12 @@ sub break_before_list_opening_containers {
         # Only consider containers already broken
         next if ( !$ris_broken_container->{$seqno} );
 
+        # Patch to fix issue b1305: the combination of -naws and ci>i appears
+        # to cause an instability.  It should almost never occur in practice.
+        next
+          if (!$rOpts_add_whitespace
+            && $rOpts_continuation_indentation > $rOpts_indent_columns );
+
         # Always ok to change ci for permanently broken containers
         if ( $ris_permanently_broken->{$seqno} ) {
             goto OK;