_rhas_broken_code_block_ => $i++,
_rhas_ternary_ => $i++,
_ris_excluded_lp_container_ => $i++,
+ _ris_lp_parent_container_ => $i++,
_rwant_reduced_ci_ => $i++,
_rno_xci_by_seqno_ => $i++,
_rbrace_left_ => $i++,
$self->[_rhas_broken_code_block_] = {};
$self->[_rhas_ternary_] = {};
$self->[_ris_excluded_lp_container_] = {};
+ $self->[_ris_lp_parent_container_] = {};
$self->[_rwant_reduced_ci_] = {};
$self->[_rno_xci_by_seqno_] = {};
$self->[_rbrace_left_] = {};
# This doesn't work well with -icb through
if (
$block_type_to_go[$iend_1] eq 'eval'
- && !$rOpts_line_up_parentheses
+ && !ref( $leading_spaces_to_go[$iend_1] )
&& !$rOpts_indent_closing_brace
&& $tokens_to_go[$iend_2] eq '{'
&& (
# "bubba Borrower Entry");
# so we will recombine if -lp is used we have
# ending comma
- && ( !$rOpts_line_up_parentheses
- || $type_iend_2 ne ',' )
+ ##&& ( !$rOpts_line_up_parentheses
+ && !(
+ $ibeg_3 > 0
+ && ref( $leading_spaces_to_go[$ibeg_3] )
+ && $type_iend_2 eq ','
+ )
)
{
my $ris_excluded_lp_container = $self->[_ris_excluded_lp_container_];
my $rLL = $self->[_rLL_];
my $rblock_type_of_seqno = $self->[_rblock_type_of_seqno_];
+ my $ris_lp_parent_container = $self->[_ris_lp_parent_container_];
my $rbreak_before_container_by_seqno =
$self->[_rbreak_before_container_by_seqno_];
my $radjusted_levels = $self->[_radjusted_levels_];
$in_lp_mode = 1;
$space_count = $gnu_position_predictor;
+ $ris_lp_parent_container->{$last_nonblank_seqno} = 1;
my $rGS_top = $rGS->[$max_gnu_stack_index];
my $min_gnu_indentation = $rGS_top->[_gs_space_count_];
# Undo ci of line with leading closing eval brace,
# but not beyond the indention of the line with
# the opening brace.
- if ( $block_type_beg eq 'eval'
- && !$rOpts_line_up_parentheses
- && !$rOpts_indent_closing_brace )
+ if (
+ $block_type_beg eq 'eval'
+ ##&& !$rOpts_line_up_parentheses
+ && !ref($leading_spaces_beg)
+ && !$rOpts_indent_closing_brace
+ )
{
(
$opening_indentation, $opening_offset,
# only options are all or none: nothing in-between looks good
$lev = $level_beg;
if ( $space_count < $last_spaces ) {
- if ($rOpts_line_up_parentheses) {
- my $lev = $level_beg;
- $indentation =
- new_lp_indentation_item( $space_count, $lev, 0, 0, 0 );
- }
- else {
- $indentation = $space_count;
- }
+## if ($rOpts_line_up_parentheses) {
+## my $lev = $level_beg;
+## $indentation =
+## new_lp_indentation_item( $space_count, $lev, 0, 0, 0 );
+## }
+## else {
+ $indentation = $space_count;
+## }
}
# revert to default if it doesn't work
$space_count = 1;
}
- if ($rOpts_line_up_parentheses) {
- $indentation =
- new_lp_indentation_item( $space_count, $lev, 0, 0, 0 );
- }
- else {
- $indentation = $space_count;
- }
+## if ($rOpts_line_up_parentheses) {
+## $indentation =
+## new_lp_indentation_item( $space_count, $lev, 0, 0, 0 );
+## }
+## else {
+ $indentation = $space_count;
+## }
}
}
my $rwant_container_open = $self->[_rwant_container_open_];
my $rK_weld_left = $self->[_rK_weld_left_];
- my $is_lp_formatting = ref( $leading_spaces_to_go[$ibeg] );
-
# Uses these global parameters:
# $rOpts_block_brace_tightness
# $rOpts_block_brace_vertical_tightness
my $ibeg_next = $ri_first->[ $n + 1 ];
my $token_end = $tokens_to_go[$iend];
my $iend_next = $ri_last->[ $n + 1 ];
- $is_lp_formatting ||= ref( $leading_spaces_to_go[$ibeg_next] );
+
if (
$type_sequence_to_go[$iend]
&& !$block_type_to_go[$iend]
$opening_vertical_tightness{$token_end} > 0
# allow 2-line method call to be closed up
- || ( $is_lp_formatting
+ || ( $rOpts_line_up_parentheses
&& $token_end eq '('
+ && $self->[_ris_lp_parent_container_]
+ ->{ $type_sequence_to_go[$iend] }
&& $iend > $ibeg
&& $types_to_go[ $iend - 1 ] ne 'b' )
)
$cvt == 1
# allow closing up 2-line method calls
- || ( $is_lp_formatting
- && $token_next eq ')' )
+ || ( $rOpts_line_up_parentheses
+ && $token_next eq ')'
+ && $self->[_ris_lp_parent_container_]
+ ->{ $type_sequence_to_go[$ibeg_next] } )
)
)
)
# flag off and set the maximum to 0. This is equivalent to
# using a large number.
my $seqno_ibeg_next = $type_sequence_to_go[$ibeg_next];
- if ( $is_lp_formatting
+ if ( $rOpts_line_up_parentheses
&& $total_weld_count
+ && $self->[_ris_lp_parent_container_]
+ ->{$seqno_ibeg_next}
&& $self->is_welded_at_seqno($seqno_ibeg_next) )
{
$min_lines = 1;
&& $token_end ne '||' && $token_end ne '&&'
# Keep break after '=' if -lp. Fixes b964 b1040 b1062 b1083 b1089.
- && !( $token_end eq '=' && $is_lp_formatting )
+ && !(
+ $token_end eq '='
+ && $rOpts_line_up_parentheses
+ && $self->[_ris_lp_parent_container_]
+ ->{ $type_sequence_to_go[$ibeg_next] }
+ )
# looks bad if we align vertically with the wrong container
&& $tokens_to_go[$ibeg] ne $tokens_to_go[$ibeg_next]