]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1259, b1260, instabilities with -bbxi=2 and very short lines
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 21 Nov 2021 14:56:39 +0000 (06:56 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 21 Nov 2021 14:56:39 +0000 (06:56 -0800)
CHANGES.md
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index b8d8deb36c079b498d59da978f105c802df740a3..b0d7f90cd2a271721008fd637de16af4fb1a066b 100644 (file)
@@ -8,14 +8,6 @@
       where -lp and -xci flags were not working well together have been fixed, such
       as happened in issue rt140025.
 
-    - A new flag -xlp has been added which can be set to avoid most of the
-      limitations of the -lp flag regarding side comments, blank lines, and
-      code blocks.  This is off by default to avoid changing existing coding,
-      so this flag has to be set to turn this feature on.  [Documentation still
-      needs to be written].  It will be included in the next release to CPAN,
-      but some details regarding how it handles very long lines may change before
-      the final release to CPAN.  This fixes issues git #64 and git #74.
-
 ## 2021 10 29
 
     - No significant bugs have been found since the last release, but several
index b73404ef8adbe0d60f2dc163752ccd25dc98a264..9b17b870e239dd4ebd30b46b50d6d93fe7549a10 100644 (file)
@@ -8292,6 +8292,57 @@ printf
 --break-before-all-operators
 --maximum-line-length=50
 
+==> b1259.in <==
+# S1
+    $menubar->Menubutton(
+        -tearoff=>0,
+        -text=>'File',
+        -menuitems=>
+            [
+            [Button=>'Save',-command=>\&save_bookmarks],[Button=>'Quit',-command=>\&exit_program],
+            ]
+    )->pack(-side=>'left');
+
+# S2
+    $menubar->Menubutton(
+        -tearoff=>0,
+        -text=>'File',
+        -menuitems=>
+                 [
+            [Button=>'Save',-command=>\&save_bookmarks],
+            [Button=>'Quit',-command=>\&exit_program],
+                 ]
+    )->pack(-side=>'left');
+
+==> b1259.par <==
+--noadd-whitespace
+--break-before-square-bracket-and-indent=2
+--break-before-square-bracket=3
+--continuation-indentation=9
+--ignore-old-breakpoints
+--maximum-line-length=94
+--variable-maximum-line-length
+
+==> b1260.in <==
+# S1
+        my @cmd =
+
+                ( $::cfg_path_diff, split ( / /, $::cfg_args_diff ), $match1, $match2 ) ;
+# S2
+        my @cmd =
+
+                 ( $::cfg_path_diff, split ( / /, $::cfg_args_diff ), $match1,
+                $match2 ) ;
+
+==> b1260.par <==
+--break-before-paren-and-indent=2
+--break-before-paren=2
+--continuation-indentation=9
+--indent-columns=8
+--maximum-line-length=89
+--space-keyword-paren
+--space-terminal-semicolon
+
 ==> b131.in <==
         unless
           ( open( SCORE, "+>>$Score_File" ) )
index 756c94675f5087cb3e22d17ed9c3317e264b4b69..2cfa1751319778242a4793c10b523396f5d34821 100644 (file)
@@ -18615,10 +18615,20 @@ EOM
         # Return if this will fit on one line
         #-------------------------------------------------------------------
 
+        # The -bbxi=2 parameters can add an extra hidden level of indentation;
+        # this needs a tolerance to avoid instability.  Fixes b1259, 1260.
+        my $tol = 0;
+        if (   $break_before_container_types{$opening_token}
+            && $container_indentation_options{$opening_token}
+            && $container_indentation_options{$opening_token} == 2 )
+        {
+            $tol = $rOpts_indent_columns;
+        }
+
         my $i_opening_minus = $self->find_token_starting_list($i_opening_paren);
         return
           unless $self->excess_line_length( $i_opening_minus, $i_closing_paren )
-          > 0;
+          + $tol > 0;
 
         #-------------------------------------------------------------------
         # Now we know that this block spans multiple lines; we have to set