## 2022 11 12.03
+ - A change was made to the way line breaks are made at the '.'
+ operator when the user sets -wba='.' to requests breaks after a '.'
+ ( this setting is not recommended because it can be hard to read ).
+ The goal of the change is to make switching from breaks before '.'s
+ to breaks after '.'s just move the dots from the end of
+ lines to the beginning of lines. For example:
+
+ # default and recommended (--want-break-before='.'):
+ $output_rules .=
+ ( 'class'
+ . $dir
+ . '.stamp: $('
+ . $dir
+ . '_JAVA)' . "\n" . "\t"
+ . '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) '
+ . '$(JAVACFLAGS) $?' . "\n" . "\t"
+ . 'echo timestamp > class'
+ . $dir
+ . '.stamp'
+ . "\n" );
+
+ # perltidy --want-break-after='.'
+ $output_rules .=
+ ( 'class' .
+ $dir .
+ '.stamp: $(' .
+ $dir .
+ '_JAVA)' . "\n" . "\t" .
+ '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) ' .
+ '$(JAVACFLAGS) $?' . "\n" . "\t" .
+ 'echo timestamp > class' .
+ $dir .
+ '.stamp' .
+ "\n" );
+
+ For existing code formatted with -wba='.', this may cause some
+ changes in the formatting of code with long concatenation chains.
+
- Added option --use-feature=class, or -uf=class, for issue rt #145706.
This adds keywords 'class', 'method', 'field', and 'ADJUST' in support of
this feature which is being tested for future inclusion in Perl.
unless $want_break_before{ $tokens_to_go[$iend_1] };
}
}
+ elsif ( $type_iend_1 eq '.' ) {
+
+ # NOTE: the logic here should match that of section 3 so that
+ # line breaks are independent of choice of break before or after.
+ # It would be nice to combine them in section 0, but the
+ # special junction case ') .' makes that difficult.
+ # This section added to fix issues c172, c174.
+ my $i_next_nonblank = $ibeg_2;
+ my $summed_len_1 = $summed_lengths_to_go[ $iend_1 + 1 ] -
+ $summed_lengths_to_go[$ibeg_1];
+ my $summed_len_2 = $summed_lengths_to_go[ $iend_2 + 1 ] -
+ $summed_lengths_to_go[$ibeg_2];
+ my $iend_1_minus = max( $ibeg_1, iprev_to_go($iend_1) );
+ my $ibeg_2_plus = min( $iend_2, $inext_to_go[$iend_2] );
+
+ return
+ unless (
+
+ # ... unless there is just one and we can reduce
+ # this to two lines if we do. For example, this
+ #
+ #
+ # $bodyA .=
+ # '($dummy, $pat) = &get_next_tex_cmd;' . '$args .= $pat;'
+ #
+ # looks better than this:
+ # $bodyA .= '($dummy, $pat) = &get_next_tex_cmd;' .
+ # '$args .= $pat;'
+
+ # check for 2 lines, not in a long broken '.' chain
+ ( $n == 2 && $n == $nmax && $type_iend_1 ne $type_iend_2 )
+
+ # ... or this would strand a short quote , like this
+ # "some long quote" .
+ # "\n";
+ || (
+ $types_to_go[$i_next_nonblank] eq 'Q'
+ && $i_next_nonblank >= $iend_2 - 2
+ && $token_lengths_to_go[$i_next_nonblank] <
+ $rOpts_short_concatenation_item_length
+
+ # additional constraints to fix c167
+ && ( $types_to_go[$iend_1_minus] ne 'Q'
+ || $summed_len_2 < $summed_len_1 )
+ )
+ );
+ }
return ( 1, $skip_Section_3 );
} ## end sub recombine_section_2