From: Steve Hancock Date: Sun, 9 May 2021 13:51:39 +0000 (-0700) Subject: Improve tolerance for welding qw quotes X-Git-Tag: 20210402.01~45 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d1de85fdea1659086b62947069d83ecb345172a1;p=perltidy.git Improve tolerance for welding qw quotes --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index d205dcd6..00d3338e 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -7928,8 +7928,8 @@ sub weld_nested_quotes { }; # Length tolerance - same as previously used for sub weld_nested - my $length_tol = - 1 + abs( $rOpts_indent_columns - $rOpts_continuation_indentation ); + my $multiline_tol = + 1 + max( $rOpts_indent_columns, $rOpts_continuation_indentation ); # look for single qw quotes nested in containers my $KNEXT = $self->[_K_first_seq_item_]; @@ -8017,9 +8017,9 @@ sub weld_nested_quotes { my $length = $rLL->[$Kinner_opening]->[_CUMULATIVE_LENGTH_] - $starting_lentot; - my $excess = $length + $length_tol - $maximum_text_length; + my $excess = $length + $multiline_tol - $maximum_text_length; - my $excess_max = ( $is_old_weld ? $length_tol : 0 ); + my $excess_max = ( $is_old_weld ? $multiline_tol : 0 ); if ( $excess >= $excess_max ) { $do_not_weld = 1; } @@ -8027,7 +8027,7 @@ sub weld_nested_quotes { if (DEBUG_WELD) { if ( !$is_old_weld ) { $is_old_weld = "" } $Msg .= -"excess=$excess>=$excess_max, length_tol=$length_tol, is_old_weld='$is_old_weld'\n"; +"excess=$excess>=$excess_max, multiline_tol=$multiline_tol, is_old_weld='$is_old_weld'\n"; } # Check weld exclusion rules for outer container diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index d9d47371..ee9191b7 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,13 @@ =over 4 +=item B + +The tolerance for welding qw quotes has been update to be the same as used +for welding other tokens. This fixes case b1129. + +9 May 2021. + =item B The welding process uses a tolerance to keep results stable. Basically, a zero