From: Steve Hancock Date: Sat, 25 Nov 2023 14:18:08 +0000 (-0800) Subject: fix b1463 X-Git-Tag: 20230912.06~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=12e69d063cb63a8de29a7a0c01b5fa15b506ba18;p=perltidy.git fix b1463 --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 19a63f3d..3cc9d388 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -11857,6 +11857,30 @@ die sprintf( --delete-old-whitespace --opening-paren-right +==> b1463.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 + ), + +); + +==> b1463.par <== +--maximum-line-length=50 +--extended-line-up-parentheses +--delete-old-whitespace +--opening-paren-right + ==> b148.in <== # state 1 @yydgoto=( diff --git a/dev-bin/run_convergence_tests.pl.expect b/dev-bin/run_convergence_tests.pl.expect index acd951c5..d7b3327b 100644 --- a/dev-bin/run_convergence_tests.pl.expect +++ b/dev-bin/run_convergence_tests.pl.expect @@ -8020,6 +8020,25 @@ die sprintf( ); +==> b1463 <== +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=( diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index ce2ee8d1..40f243ee 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -32028,25 +32028,17 @@ sub set_vertical_tightness_flags { # give -kba priority over -otr (b1445) && !$self->[_rbreak_after_Klast_]->{ $K_to_go[$iend] } + + # Fix b1462, b1463: avoid possible edge instability with + # the combination -xlp and -dws + && !( + $rOpts_extended_line_up_parentheses + && $rOpts_delete_old_whitespace + ) ) { 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;