# two semi-stable states, if we do not weld. So the rules for
# not welding have to be carefully defined and tested.
my $do_not_weld;
+
+ my $is_one_line_weld;
+
+ my $iline_oc = $outer_closing->[_LINE_INDEX_];
+
if ( !$touch_previous_pair ) {
# If this pair is not adjacent to the previous pair (skipped or
$ci_level * $rOpts_continuation_indentation;
}
+ # An existing one-line weld is a line in which
+ # (1) the containers are all on one line, and
+ # (2) the line does not exceed the allowable length, and
+ # (3) there are no good line breaks (comma or semicolon).
+ # This flag is used to avoid creating blinkers.
+ if ( $iline_oo == $iline_oc && $excess_length_to_K->($Klast) <= 0 )
+ {
+ my $rtype_count =
+ $self->[_rtype_count_by_seqno_]->{$inner_seqno};
+ $is_one_line_weld = 1
+ unless ( $rtype_count
+ && ( $rtype_count->{','} || $rtype_count->{';'} ) );
+ }
+
# DO-NOT-WELD RULE 1:
# Do not weld something that looks like the start of a two-line
# function call, like this: <<snippets/wn6.in>>
# $top_label->set_text( gettext(
# "Unable to create personal directory - check permissions.") );
- my $iline_oc = $outer_closing->[_LINE_INDEX_];
my $token_oo = $outer_opening->[_TOKEN_];
if ( $iline_oc == $iline_oo + 1
&& $iline_io == $iline_ic
# $_[0]->();
# } );
- if ( $iline_ic == $iline_io ) {
+ if ( !$is_one_line_weld && $iline_ic == $iline_io ) {
my $token_oo = $outer_opening->[_TOKEN_];
$do_not_weld ||= $token_oo eq '(';
=over 4
+=item B<Fixed blinker related to large -ci, short line length and -wn>
+
+In random testing with convergence a 'blinker' (oscillating states) was found
+for the following script
+
+ sub _prompt {
+
+ print $_[0];
+ return (
+ readline
+ (*{$_[1]})!~
+ /^q/i)
+ ; # Return false if user types 'q'
+
+ }
+
+with the following specific parameters:
+
+ --maximum-line-length=32
+ --indent-columns=6
+ --continuation-indentation=7
+ --weld-nested-containers
+ --extended-continuation-indentation
+ --noadd-whitespace
+
+The other state was
+
+ sub _prompt {
+
+ print $_[0];
+ return (
+ readline(
+ *{
+ $_
+ [
+ 1
+ ]
+ }
+ )!~/^q/i
+ )
+ ; # Return false if user types 'q'
+
+ }
+
+All of the listed parameters are required to cause this, but the main cause
+is the very large continuation indentation and short line length. Welding
+was being turned on and off in this case. Normally welding is not done if
+all containers are on a single line, but an exception was made to detect
+a situation like this and keep the welded string together. Updated 13 Jan 2021.
+
+
=item B<Fixed incorrect guess of division vs pattern>
A syntax error was produced in random testing when perltidy was fed
sub _DR () { pi2 / 360 }
sub _RD () { 360 / pi2 }
-This update was made 13 Jan 2021.
-
+This update was made 13 Jan 2021, a50ecf8.
=item B<Correct formula for estimating line length with -wn option>
caused an oscillation between two states. An unusual feature which contributed
to the problem is the very large ci value. This is fixed in a patch made 12 Jan
-2021.
+2021, 9a97dba.
=back