From: Steve Hancock Date: Sat, 22 Oct 2022 04:14:39 +0000 (-0700) Subject: optimization X-Git-Tag: 20221112~28 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=985c45550c60fe4574bde29f38eaed730061304f;p=perltidy.git optimization --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 8be91560..e4df61af 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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