For a specific example, the following line
+ oneliner { --maximum-line-length=0 --noadd-newlines }
+
+or equivalently with abbreviations
+
oneliner { -l=0 -nanl }
could be placed in a F<.perltidyrc> file to temporarily override the maximum
# Variables needed for estimating line lengths
my $starting_indent;
my $starting_lentot;
+ my $starting_level;
my $iline_outer_opening = -1;
my $weld_count_this_start = 0;
# Add a tolerance for welds over multiple lines to avoid blinkers
my $iline_K = $rLL->[$K]->[_LINE_INDEX_];
- my $tol = ( $iline_K > $iline_outer_opening ) ? $multiline_tol : 0;
+ my $level_K = $rLL->[$K]->[_LEVEL_];
+ my $tol = 0;
+ if (
+ $iline_K > $iline_outer_opening
+
+ # fix for cases b1041 b1055:
+ || $level_K > $starting_level
+ )
+ {
+ $tol = $multiline_tol;
+ }
my $excess_length =
$starting_indent + $length + $tol - $rOpts_maximum_line_length;
$Kref <= 0 ? 0 : $rLL->[ $Kref - 1 ]->[_CUMULATIVE_LENGTH_];
$starting_indent = 0;
- my $level = $rLL->[$Kref]->[_LEVEL_];
+ $starting_level = $rLL->[$Kref]->[_LEVEL_];
my $ci_level = $rLL->[$Kref]->[_CI_LEVEL_];
if ( !$rOpts_variable_maximum_line_length ) {
- $starting_indent = $rOpts_indent_columns * $level +
+ $starting_indent = $rOpts_indent_columns * $starting_level +
$ci_level * $rOpts_continuation_indentation;
}
}
}
}
- }
+ } ## end starting new weld sequence
# DO-NOT-WELD RULE 2:
# Do not weld an opening paren to an inner one line brace block
$starting_lentot =
$self->cumulative_length_before_K($Kinner_opening);
$starting_indent = 0;
+ $starting_level = $inner_opening->[_LEVEL_];
if ( !$rOpts_variable_maximum_line_length ) {
- my $level = $inner_opening->[_LEVEL_];
- $starting_indent = $rOpts_indent_columns * $level;
+ $starting_indent = $rOpts_indent_columns * $starting_level;
}
if (DEBUG_WELD) {
=over 4
+=item B<Fix rare convergence problem with -wn>
+
+Random testing produced some cases in which unusual parameter combinations
+caused lack of convergence for the -wn flag. The problem was fixed by
+adjusting a tolerance in the line length calculation.
+
+This fixes cases b1041 b1055.
+
+2 Apr 2021.
+
=item B<Avoid conflict of -bli and -xci>
Random testing produced a case with the combination -bli and -xci which did not
PDL::Graphics::TriD::Scale->new( $sx, $sy, $sz ) );
# but weld this more complex statement
- my $compass = uc( opposite_direction( line_to_canvas_direction(
- @{ $coords[0] }, @{ $coords[1] }
- ) ) );
+ my $compass = uc( opposite_direction(
+ line_to_canvas_direction( @{ $coords[0] }, @{ $coords[1] } )
+ ) );
# OLD: do not weld to a one-line block because the function could
# get separated from its opening paren.
../snippets24.t fpva.fpva2
../snippets24.t lpxl.def
../snippets24.t lpxl.lpxl1
-../snippets24.t lpxl.lpxl2
../snippets24.t lpxl.lpxl3
../snippets24.t lpxl.lpxl4
../snippets24.t lpxl.lpxl5
PDL::Graphics::TriD::Scale->new( $sx, $sy, $sz ) );
# but weld this more complex statement
- my $compass = uc( opposite_direction( line_to_canvas_direction(
- @{ $coords[0] }, @{ $coords[1] }
- ) ) );
+ my $compass = uc( opposite_direction(
+ line_to_canvas_direction( @{ $coords[0] }, @{ $coords[1] } )
+ ) );
# OLD: do not weld to a one-line block because the function could
# get separated from its opening paren.