]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1462
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 21 Nov 2023 15:18:45 +0000 (07:18 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 21 Nov 2023 15:18:45 +0000 (07:18 -0800)
dev-bin/run_convergence_tests.pl.data
dev-bin/run_convergence_tests.pl.expect
lib/Perl/Tidy/Formatter.pm

index 2b3d7b9d3d7763a733ec0092246ef2fb7e92c95e..19a63f3d50f41a88b11b1d03c8d836d18638256c 100644 (file)
@@ -11831,6 +11831,32 @@ sub bubba {
 --want-break-before='='
 --opening-anonymous-sub-brace-on-new-line
 
+==> b1462.in <==
+die sprintf(
+      "Usage: %s [ -r | -a | -f fmt ] file ...\n",
+      (
+        $0=~
+          m|.*/(.*)|o
+      ),
+
+);
+
+die sprintf(
+     "Usage: %s [ -r | -a | -f fmt ] file ...\n",(
+       $0=~
+         m|.*/(.*)|o
+     ),
+
+);
+
+==> b1462.par <==
+--maximum-line-length=50
+--indent-columns=7
+--noadd-whitespace
+--extended-line-up-parentheses
+--delete-old-whitespace
+--opening-paren-right
+
 ==> b148.in <==
 # state 1
 @yydgoto=(
index 03dd2581f08c6dcc6c5ca700c68b26ea23e83bd7..acd951c5838e0ca85391f375bb15b6fd00260907 100644 (file)
@@ -8001,6 +8001,25 @@ sub bubba {
         $C_sigmas = sub
         { [ $a3::COMMON, $a3::Offset{lcount} + 47 ] };
 
+==> b1462 <==
+die sprintf(
+     "Usage: %s [ -r | -a | -f fmt ] file ...\n",
+     (
+       $0=~
+         m|.*/(.*)|o
+     ),
+
+);
+
+die sprintf(
+     "Usage: %s [ -r | -a | -f fmt ] file ...\n",
+     (
+       $0=~
+         m|.*/(.*)|o
+     ),
+
+);
+
 ==> b148 <==
 # state 1
 @yydgoto=(
index 834b4329e1cd5d02d9f6c562042b3869b758cd22..ce2ee8d15a98591ecf083912eb96e503cba9aefe 100644 (file)
@@ -32032,6 +32032,21 @@ sub set_vertical_tightness_flags {
         {
             my $spaces = ( $types_to_go[ $ibeg_next - 1 ] eq 'b' ) ? 1 : 0;
 
+            # Fix b1462 - avoid edge instability problem with -lp -naws:
+            # If the '(' started a different line, consider the newline
+            # to be a space. This is restricted to -lp for now but
+            # could be generalized if necessary.
+            if (  !$spaces
+                && $rOpts_line_up_parentheses
+                && !$rOpts_add_whitespace )
+            {
+                my $Kend        = $K_to_go[$iend];
+                my $Kbeg_next   = $K_to_go[$ibeg_next];
+                my $ix_end      = $self->[_rLL_]->[$Kend]->[_LINE_INDEX_];
+                my $ix_beg_next = $self->[_rLL_]->[$Kbeg_next]->[_LINE_INDEX_];
+                if ( $ix_end != $ix_beg_next ) { $spaces = 1 }
+            }
+
             $vt_type         = 2;
             $vt_opening_flag = 0;
             $vt_closing_flag = $spaces;