]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1399
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 29 Oct 2022 01:23:03 +0000 (18:23 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 29 Oct 2022 01:23:03 +0000 (18:23 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 6f59edbd3fd3eaac26c783c9ce91803a5bb15264..24571afb923b02ea923521b6d469c892009ef8ef 100644 (file)
@@ -10524,6 +10524,49 @@ SOAP::Transport::HTTP::Daemon->new (LocalAddr => $host,
 --maximum-line-length=92
 --space-keyword-paren
 
+==> b1399.in <==
+use constant GRAPH_SIZE => 100;
+for ( my $i = 0 ;
+      $i < @$data ;
+      $i++ )
+  {
+     $polygon->addPt(
+          ORIGIN_X_COORD
+            + GRAPH_SIZE
+            / ( @$data - 1 )
+            * $i,
+          ORIGIN_Y_COORD
+            - $$data[$i]
+            * GRAPH_SIZE
+            / LOAD_MAX
+     );
+  } ## end for ( my $i = 0; $i < ...)
+
+for ( my $i = 0 ;
+      $i < @$data ;
+      $i++ )
+  {
+     $polygon->addPt(
+          ORIGIN_X_COORD
+            + GRAPH_SIZE
+            / ( @$data - 1 )
+            * $i,
+          ORIGIN_Y_COORD
+            - $$data[$i]
+            * GRAPH_SIZE / LOAD_MAX,
+     );
+  } ## end for ( my $i = 0; $i < ...)
+
+==> b1399.par <==
+--line-up-parentheses
+--maximum-line-length=33
+--keep-old-breakpoints-before='-'
+--variable-maximum-line-length
+--indent-columns=5
+--break-before-all-operators
+--break-at-old-comma-breakpoints
+--brace-left-and-indent
+
 ==> b140.in <==
 $cmd[ $i ]=[
         $s, $e, $cmd, \@hunk, $i ] ;
index 432e4c7bd5a2cab39141d6700cc5b5e80e4b184b..e07c6e8097d16160770ed2d13aba31197ab6a902 100644 (file)
@@ -16448,6 +16448,7 @@ sub break_all_chain_tokens {
 
     # now look for any interior tokens of the same types
     $count = 0;
+    my $has_interior_dot_or_plus;
     for my $n ( 0 .. $nmax ) {
         my $il = $ri_left->[$n];
         my $ir = $ri_right->[$n];
@@ -16459,21 +16460,27 @@ sub break_all_chain_tokens {
             if ( $saw_chain_type{$key} ) {
                 push @{ $interior_chain_type{$key} }, $i;
                 $count++;
+                $has_interior_dot_or_plus ||= ( $key eq '.' || $key eq '+' );
             }
         }
     }
     return unless $count;
 
+    my @keys = keys %saw_chain_type;
+
+    # quit if just ONE continuation line with leading .  For example--
+    # print LATEXFILE '\framebox{\parbox[c][' . $h . '][t]{' . $w . '}{'
+    #  . $contents;
+    # Fixed for b1399.
+    if ( $has_interior_dot_or_plus && $nmax == 1 && @keys == 1 ) {
+        return;
+    }
+
     # now make a list of all new break points
     my @insert_list;
 
     # loop over all chain types
-    foreach my $key ( keys %saw_chain_type ) {
-
-        # quit if just ONE continuation line with leading .  For example--
-        # print LATEXFILE '\framebox{\parbox[c][' . $h . '][t]{' . $w . '}{'
-        #  . $contents;
-        last if ( $nmax == 1 && $key =~ /^[\.\+]$/ );
+    foreach my $key (@keys) {
 
         # loop over all interior chain tokens
         foreach my $itest ( @{ $interior_chain_type{$key} } ) {