]> git.donarmstrong.com Git - perltidy.git/commitdiff
optimization
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 22 Oct 2022 04:14:39 +0000 (21:14 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 22 Oct 2022 04:14:39 +0000 (21:14 -0700)
lib/Perl/Tidy/Formatter.pm

index 8be915601ed377316de5e31cc24d8b2e4ba694dd..e4df61afc4274671b526c7b1a2558b7f53545a84 100644 (file)
@@ -16016,8 +16016,8 @@ EOM
         #-------------------------
         if (
 
-            # we aren't allowed to add any newlines
-            !$rOpts_add_newlines
+            # there is just one token
+            !$max_index_to_go
 
             # or,
             || (
@@ -16031,6 +16031,10 @@ EOM
                 # and we don't already have an interior breakpoint
                 && !$forced_breakpoint_count
             )
+
+            # or, we aren't allowed to add any newlines
+            || !$rOpts_add_newlines
+
           )
         {
             $ri_first = [$imin];
@@ -16063,11 +16067,12 @@ EOM
 
             $self->insert_final_ternary_breaks( $ri_first, $ri_last )
               if (@colon_list);
-        }
 
-        $self->insert_breaks_before_list_opening_containers( $ri_first,
-            $ri_last )
-          if ( %break_before_container_types && $max_index_to_go > 0 );
+            $self->insert_breaks_before_list_opening_containers( $ri_first,
+                $ri_last )
+              if ( %break_before_container_types && $max_index_to_go > 0 );
+
+        }
 
         #-------------------
         # -lp corrector step