]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1431
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 20 Nov 2022 19:03:17 +0000 (11:03 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 20 Nov 2022 19:03:17 +0000 (11:03 -0800)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 6555c12e9889e0c3f5def2e3dbe70435a63e29e0..6ef88fd6b0f68a670f3576415a418c33d645550a 100644 (file)
@@ -10988,6 +10988,29 @@ my$sem=sub
 --variable-maximum-line-length
 --want-trailing-commas='m'
 
+==> b1431.in <==
+            C4::Circulation::AddRenewal(
+                             $issue->{
+                                'borrowernumber'},    # borrowernumber
+                             $item->itemnumber,
+                             undef, undef,
+                             $circ->{'date'},
+            ) unless ($DEBUG);
+
+            C4::Circulation::AddRenewal(
+                             $issue->{'borrowernumber'}, # borrowernumber
+                             $item->itemnumber,
+                             undef, undef,
+                             $circ->{'date'},
+            ) unless ($DEBUG);
+
+==> b1431.par <==
+--continuation-indentation=9
+--extended-line-up-parentheses
+--ignore-side-comment-lengths
+--maximum-line-length=42
+--variable-maximum-line-length
+
 ==> b146.in <==
 # State 1
 
index 6ddb50490636b998cbe6bb205a902aa8d95deb72..eabc70ebe0622253ff75549da59105ed91203a6f 100644 (file)
@@ -12088,9 +12088,11 @@ sub xlp_collapsed_lengths {
                 # token, look for the closing token and comma at the end of the
                 # next line. If so, combine the two lines to get the correct
                 # sums.  This problem seems to require -xlp -vtc=2 and blank
-                # lines to occur.
+                # lines to occur. Use %is_opening_type to fix b1431.
                 #--------------------------------------------------------------
-                if ( $rLL->[$K_terminal]->[_TYPE_] eq '{' && !$has_comment ) {
+                if ( $is_opening_type{ $rLL->[$K_terminal]->[_TYPE_] }
+                    && !$has_comment )
+                {
                     my $seqno_end = $rLL->[$K_terminal]->[_TYPE_SEQUENCE_];
                     my $Kc_test   = $rLL->[$K_terminal]->[_KNEXT_SEQ_ITEM_];
 
@@ -12103,6 +12105,9 @@ sub xlp_collapsed_lengths {
                     #
                     #  Help::WorkSubmitter->_filter_chores_and_maybe_warn_user(
                     #                                    $story_set_all_chores),
+                    # or this (b1438):
+                    #        $issue->{
+                    #           'borrowernumber'},  # borrowernumber
                     if (   defined($Kc_test)
                         && $seqno_end == $rLL->[$Kc_test]->[_TYPE_SEQUENCE_]
                         && $rLL->[$Kc_test]->[_LINE_INDEX_] == $iline + 1 )
@@ -12114,8 +12119,17 @@ sub xlp_collapsed_lengths {
                         my ( $K_first_next, $K_terminal_next ) =
                           @{ $line_of_tokens_next->{_rK_range} };
 
-                        # NOTE: Do not try to do this if there is a side comment
-                        # because then the instability does not seem to occur.
+                        # backup at a side comment
+                        if ( defined($K_terminal_next)
+                            && $rLL->[$K_terminal_next]->[_TYPE_] eq '#' )
+                        {
+                            my $Kprev =
+                              $self->K_previous_nonblank($K_terminal_next);
+                            if ( defined($Kprev) && $Kprev >= $K_first_next ) {
+                                $K_terminal_next = $Kprev;
+                            }
+                        }
+
                         if (
                             defined($K_terminal_next)