]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix issues b1216-b1218
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 27 Sep 2021 00:21:59 +0000 (17:21 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 27 Sep 2021 00:21:59 +0000 (17:21 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 235e5570b9025f09f33f29f1c284281348c1badc..50c85f78948fa49580d1b481a691b1ad720540e0 100644 (file)
@@ -7456,6 +7456,27 @@ $bc[
 --maximum-line-length=34
 --variable-maximum-line-length
 
+==> b1218.in <==
+# S1
+is(
+     Koha::Acquisition::Funds->search->count,
+     $nb_of_funds + 1,
+     'The fund should have been added'
+);
+
+# S2
+is( Koha::Acquisition::Funds->search->count,
+     $nb_of_funds + 1,
+     'The fund should have been added' );
+
+
+==> b1218.par <==
+--continuation-indentation=7
+--indent-columns=6
+--line-up-parentheses
+--maximum-line-length=50
+--variable-maximum-line-length
+
 ==> b131.in <==
         unless
           ( open( SCORE, "+>>$Score_File" ) )
index cc56fb6201d4b240708999b9c0a20cf8ef22d07c..80c06c1880ee1ec566349c2295e62dd44c905c0d 100644 (file)
@@ -18239,13 +18239,15 @@ EOM
         # Number of free columns across the page width for laying out tables
         my $columns = table_columns_available($i_first_comma);
 
-        # Patch for b1210 when -vmll is set.  If we are unable to break after
-        # an opening paren, then the maximum line length for the first line
-        # will be less than the later lines.  So we use the minimum possible.
+        # Patch for b1210 and b1216-b1218 when -vmll is set.  If we are unable
+        # to break after an opening paren, then the maximum line length for the
+        # first line could be less than the later lines.  So we need to reduce
+        # the line length.  Normally, we will get a break after an opening
+        # paren, but in some cases we might not.
         if (   $rOpts_variable_maximum_line_length
             && $tokens_to_go[$i_opening_paren] eq '('
-            && @i_term_begin
-            && !$old_breakpoint_to_go[$i_opening_paren] )
+            && @i_term_begin )
+          ##&& !$old_breakpoint_to_go[$i_opening_paren] )  ## in b1210 patch
         {
             my $ib   = $i_term_begin[0];
             my $type = $types_to_go[$ib];
@@ -18253,8 +18255,18 @@ EOM
             # So far, the only known instance of this problem is when
             # a bareword follows an opening paren with -vmll
             if ( $type eq 'w' ) {
-                my $columns2 = table_columns_available($i_opening_paren);
-                $columns = min( $columns, $columns2 );
+
+                # If a line starts with paren+space+terms, then its max length
+                # could be up to ci+2-i spaces less than if the term went out
+                # on a line after the paren.  So..
+                my $tol = max( 0,
+                    2 + $rOpts_continuation_indentation -
+                      $rOpts_indent_columns );
+                $columns = max( 0, $columns - $tol );
+
+                ## Here is the original b1210 fix, but it failed on b1216-b1218
+                ##my $columns2 = table_columns_available($i_opening_paren);
+                ##$columns = min( $columns, $columns2 );
             }
         }