From: Steve Hancock Date: Thu, 5 Nov 2020 14:43:49 +0000 (-0800) Subject: fix issue git #45, -wn and -vtc=n now work together X-Git-Tag: 20201001.03~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1fbc381265208c5013a49daa60a3683d61432da6;p=perltidy.git fix issue git #45, -wn and -vtc=n now work together --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index cbc219e4..ff8a487b 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -18984,10 +18984,11 @@ sub set_vertical_tightness_flags { my $cvt = $closing_vertical_tightness{$token_next}; if ( - # never append a trailing line like )->pack( - # because it will throw off later alignment + # Never append a trailing line like ')->pack(' because it + # will throw off later alignment. So this line must start at a + # deeper level than the next line (fix1 for welding, git #45). ( - $nesting_depth_to_go[$ibeg_next] == + $nesting_depth_to_go[$ibeg_next] >= $nesting_depth_to_go[ $iend_next + 1 ] + 1 ) && ( @@ -19014,7 +19015,8 @@ sub set_vertical_tightness_flags { @types_to_go[ $ibeg_next + 1 .. $ibeg_next + 2 ] ); # append closing token if followed by comment or ';' - if ( $str =~ /^b?[#;]/ ) { $ok = 1 } + # or another closing token (fix2 for welding, git #45) + if ( $str =~ /^b?[\)\]\}R#;]/ ) { $ok = 1 } } if ($ok) { diff --git a/t/snippets/git45.in b/t/snippets/git45.in new file mode 100644 index 00000000..c8261fe7 --- /dev/null +++ b/t/snippets/git45.in @@ -0,0 +1,22 @@ +# git#45 -vtc=n and -wn were not working together +if ( + $self->_add_fqdn_host( + name => $name, + realm => $realm + ) + ) +{ + ...; +} + +# do not stack )->pack( +my $hlist = $control::control->Scrolled( + 'HList', + drawbranch => 1, + width => 20, + -scrollbars => 'w' +)->pack( + -side => 'bottom', + -expand => 1 +); + diff --git a/t/snippets/git45.par b/t/snippets/git45.par new file mode 100644 index 00000000..d5260269 --- /dev/null +++ b/t/snippets/git45.par @@ -0,0 +1 @@ +-vtc=1 -wn