]> git.donarmstrong.com Git - perltidy.git/commitdiff
Improve tolerance for welding qw quotes
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 9 May 2021 13:51:39 +0000 (06:51 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 9 May 2021 13:51:39 +0000 (06:51 -0700)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index d205dcd6bf2a3192f06b5691f6d860b94bf3d67d..00d3338e68582f715e58301f19eade380e881dc8 100644 (file)
@@ -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
index d9d47371ba319ab0670579fb32b0a29e4dfda5e2..ee9191b775652acf51757dfefa2c2e4a3fe3ab6f 100644 (file)
@@ -2,6 +2,13 @@
 
 =over 4
 
+=item B<Improve tolerance for welding qw quotes>
+
+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<Revise weld tolerances, simplify code, fix welded ci>
 
 The welding process uses a tolerance to keep results stable.  Basically, a zero