my $K_opening = $K_opening_container->{$seqno};
next unless defined($K_opening);
- # only for lists, not for code blocks
- my $block_type = $rLL_new->[$K_opening]->[_BLOCK_TYPE_];
- next if ($block_type);
-
# code errors may leave undefined closing tokens
my $K_closing = $K_closing_container->{$seqno};
next unless defined($K_closing);
+ my $lx_open = $rLL_new->[$K_opening]->[_LINE_INDEX_];
+ my $lx_close = $rLL_new->[$K_closing]->[_LINE_INDEX_];
+ my $line_diff = $lx_close - $lx_open;
+ $ris_broken_container->{$seqno} = $line_diff;
+
+ # The rest is only for lists, not for code blocks
+ my $block_type = $rLL_new->[$K_opening]->[_BLOCK_TYPE_];
+ next if ($block_type);
+
my $rtype_count = $rtype_count_by_seqno->{$seqno};
next unless ($rtype_count);
my $comma_count = $rtype_count->{','};
my $is_list = ( $comma_count || $fat_comma_count ) && !$semicolon_count;
if ($is_list) { $ris_list_by_seqno->{$seqno} = $seqno }
- my $lx_open = $rLL_new->[$K_opening]->[_LINE_INDEX_];
- my $lx_close = $rLL_new->[$K_closing]->[_LINE_INDEX_];
- my $line_diff = $lx_close - $lx_open;
-
if ($line_diff) {
- $ris_broken_container->{$seqno} = $line_diff;
my $seqno_parent = $rparent_of_seqno->{$seqno};
if ( defined($seqno_parent) && $seqno_parent ne SEQ_ROOT ) {
$rhas_broken_container->{$seqno_parent} = 1;
# line difference is > 1 (see case b977)
if ($ok) {
my $seqno = $type_sequence_to_go[$i_line_start];
- if ( $ris_broken_container->{$seqno}
- && $ris_broken_container->{$seqno} <= 1 )
+ if ( !$ris_broken_container->{$seqno}
+ || $ris_broken_container->{$seqno} <= 1 )
{
$ok = 0;
+ print
+ "BOOGA, $ris_broken_container->{$seqno}\n";
}
}
unless $vert_last_nonblank_token =~
/^(if|unless|elsif)$/;
}
+
+ # Do not align a spaced-function-paren - fixes git #53
+ # Note that index $i-1 is a blank token if we get here
+ if ( $i > $ibeg + 1 ) {
+ my $type_m = $types_to_go[ $i - 2 ];
+ my $token_m = $tokens_to_go[ $i - 2 ];
+
+ # this is the same test as 'space-function-paren'
+ if ( $type_m =~ /^[wUG]$/
+ || $type_m eq '->'
+ || $type_m =~ /^[wi]$/
+ && $token_m =~ /^(\&|->)/ )
+ {
+ $alignment_type = "";
+ }
+ }
}
# be sure the alignment tokens are unique
=over 4
+=item B<Fix for issue git #53, do not align spaced function parens>
+
+Introducing a space before a function call paren had a side effect of
+allowing the vertical aligner to align the parens, as in the example.
+
+ # OLD and NEW, default without -sfp:
+ log_something_with_long_function( 'This is a log message.', 2 );
+ Coro::AnyEvent::sleep( 3, 4 );
+
+ # OLD: perltidy -sfp
+ log_something_with_long_function ( 'This is a log message.', 2 );
+ Coro::AnyEvent::sleep ( 3, 4 );
+
+ # NEW: perltidy -sfp
+ log_something_with_long_function ( 'This is a log message.', 2 );
+ Coro::AnyEvent::sleep ( 3, 4 );
+
+This update changes the default to not do this vertical alignment. This should
+have been the default but this side-effect was missed when the -sfp parameter
+was added. Note that parens following keywords are likewise not vertically
+aligned.
+
+5 Mar 2021.
+
=item B<Fix issue git#54 involving -bbp=n and -bbpi=n>
In this issue, different results were obtained depending upon the existance of
At the same time, a known problem involving the combination -lp -bbp=n -bbpi=n
was fixed. This fixes cases b826 b909 b989.
-4 Mar 2021.
+4 Mar 2021, 872d4b4.
=item B<Fix several minor weld issues>