]> git.donarmstrong.com Git - perltidy.git/commitdiff
Improved line break, case c060
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 15 Aug 2021 23:52:50 +0000 (16:52 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 15 Aug 2021 23:52:50 +0000 (16:52 -0700)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index a3c76d464f14c7cfeff2a01f7b8852960820e403..da7f321c272369cab00469f1fb9f746648fe9b82 100644 (file)
@@ -14507,6 +14507,15 @@ sub break_equals {
                         && $nesting_depth_to_go[$ibeg_3] ==
                         $nesting_depth_to_go[$ibeg_2] );
 
+                    # Combine a trailing && term with an || term: fix for c060
+                    # This is rare but can happen.
+                    $ok ||= 1
+                      if ( $ibeg_3 < 0
+                        && $type_ibeg_2 eq '&&'
+                        && $type_ibeg_1 eq '||'
+                        && $nesting_depth_to_go[$ibeg_2] ==
+                        $nesting_depth_to_go[$ibeg_1] );
+
                     next if !$ok && $want_break_before{$type_ibeg_2};
                     $forced_breakpoint_to_go[$iend_1] = 0;
 
index c06df8748853991c55548c4cad36ae2a42a682bb..87c7eb2f38a30228a18f24401b11233f1bbf1d68 100644 (file)
@@ -2,6 +2,29 @@
 
 =over 4
 
+=item B<Improved line break, case c060>
+
+The default formatting produced an undesirable line break at the last '&&' term
+in the following:
+
+    my $static = grep {
+             $class       =~ /^$_$/
+          || $fullname    =~ /^$_$/
+          || $method_name =~ /^$_$/
+          && ( $class eq 'main' )
+    } grep { !m![/\\.]! } $self->dispatch_to;    # filter PATH
+
+This update corrects this to give
+
+    my $static = grep {
+             $class       =~ /^$_$/
+          || $fullname    =~ /^$_$/
+          || $method_name =~ /^$_$/ && ( $class eq 'main' )
+    } grep { !m![/\\.]! } $self->dispatch_to;    # filter PATH
+
+15 Aug 2021.
+
+
 =item B<Fix error check caused by -wn -iscl, case c058>
 
 Testing with random parameters triggered an an internal error check.  This was
@@ -17,14 +40,14 @@ Testing with random parameters produced unstable formatting
 involving parameters which included -lp -sbvtc=1. This update
 fixes this problem, case b1193.
 
-13 Aug 2021.
+13 Aug 2021, d4c3425.
 
 =item B<Fix error in tokenizer, issue c055>
 
 The ultimate cause of the undefined variable reference in the previous issue was
 found to be a typo in the tokenizer.  This update finishes fixing issue c055.
 
-10 Aug 2021
+10 Aug 2021, 2963db3
 
 =item B<Fix undefined variable reference in development version>