From 58a7895c9b47b059a5b4bdea6a2331831c61c20f Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 12 Feb 2021 07:56:01 -0800 Subject: [PATCH] Define left side bond strengths for unary plus and minus --- lib/Perl/Tidy/Formatter.pm | 4 ++++ local-docs/BugLog.pod | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 5a1c86b7..16ef050f 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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); diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index c47dba66..5def8e90 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,14 @@ =over 4 +=item B + +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 Random testing produced some blinking cases which were related to -- 2.39.5