]> git.donarmstrong.com Git - perltidy.git/commitdiff
Define left side bond strengths for unary plus and minus
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 12 Feb 2021 15:56:01 +0000 (07:56 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 12 Feb 2021 15:56:01 +0000 (07:56 -0800)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index 5a1c86b70392f229f31074794e3050f0e6801006..16ef050fb161daddadc8bb2e03c242ac9e10c369 100644 (file)
@@ -2879,6 +2879,10 @@ EOM
         @right_bond_strength{@q} =
           ( 0.91 * NOMINAL + 0.09 * WEAK ) x scalar(@q);
 
+        # Define left strength of unary plus and minus (fixes case b511)
+        $left_bond_strength{p} = $left_bond_strength{'+'};
+        $left_bond_strength{m} = $left_bond_strength{'-'};
+
         # breaking BEFORE these is just ok:
         @q                       = qw# >> << #;
         @right_bond_strength{@q} = (STRONG) x scalar(@q);
index c47dba664601444c2dedf97af8878b3d66b7db88..5def8e904d86934912e29c482a6de89a3186fad2 100644 (file)
@@ -2,6 +2,14 @@
 
 =over 4
 
+=item B<Define left side bond strengths for unary plus and minus>
+
+Random testing produced a blinking state which was traced to the unary plus not
+having a defined strength in the line break algorithm.  This was fixed by
+setting it to be the same as the left strength of a plus.  This fixes case
+b511.
+12 Feb 2021.
+
 =item B<Fix problem with breaking at an = sign>
 
 Random testing produced some blinking cases which were related to