# Perltidy Change Log
+ - Side comment locations reset at a line ending in a level 0 open
+ block, such as when a new multi-line sub begins. This is intended to
+ help keep side comments from drifting to far to the right.
+
## 2020 08 22
- Fix RT #133166, encoding not set for -st. Also reported as RT #133171
$self->make_alignment_patterns( $ibeg, $iend,
$ralignment_type_to_go );
- my ( $indentation, $lev, $level_end, $terminal_type,
+ my ( $indentation, $lev, $level_end, $terminal_type, $i_terminal,
$is_semicolon_terminated, $is_outdented_line )
= $self->set_adjusted_indentation( $ibeg, $iend, $rfields,
$rpatterns, $ri_first, $ri_last,
$rindentation_list, $ljump, $starting_in_quote,
$is_static_block_comment, );
+ my $terminal_block_type=$block_type_to_go[$i_terminal];
+
# we will allow outdenting of long lines..
my $outdent_long_lines = (
$rvalign_hash->{rpatterns} = $rpatterns;
$rvalign_hash->{rtokens} = $rtokens;
$rvalign_hash->{rfield_lengths} = $rfield_lengths;
+ $rvalign_hash->{terminal_block_type} = $terminal_block_type;
my $vao = $self->[_vertical_aligner_object_];
$vao->valign_input($rvalign_hash);
}
}
- return ( $indentation, $lev, $level_end, $terminal_type,
+ return ( $indentation, $lev, $level_end, $terminal_type, $i_terminal,
$is_semicolon_terminated, $is_outdented_line );
}
}
my $rtokens = $rline_hash->{rtokens};
my $rpatterns = $rline_hash->{rpatterns};
my $rfield_lengths = $rline_hash->{rfield_lengths};
+ my $terminal_block_type = $rline_hash->{terminal_block_type};
# number of fields is $jmax
# number of tokens between fields is $jmax-1
$self->[_consecutive_block_comments_] = 0;
}
+ # Reset side comment location if we are entering a new block from level 0.
+ # This is intended to keep them from drifting too far to the right.
+ if ( $terminal_block_type && $level == 0 && $level_end > $level ) {
+ $self->forget_side_comment();
+ }
+
my $group_level = $self->[_group_level_];
0 && do {
'Nov', 'Dec'
);
-{ # this side comment will not align
+{ # this side comment will not align
my $IGNORE = 0; # This is a side comment
# This is a hanging side comment
# And so is this
'Nov', 'Dec'
);
-{ # this side comment will not align
+{ # this side comment will not align
my $IGNORE = 0; # This is a side comment
# This is a hanging side comment
# And so is this
# abbreviation, so we can't use it.
delete $hashref->{$abbrev};
}
-else { # We're the third word to have this
- # abbreviation, so skip to the next word.
+else { # We're the third word to have this
+ # abbreviation, so skip to the next word.
next WORD;
}
'Nov', 'Dec'
);
-{ # this side comment will not align
+{ # this side comment will not align
my $IGNORE = 0; # This is a side comment
# This is a hanging side comment
# And so is this
'Nov', 'Dec'
);
-{ # this side comment will not align
+{ # this side comment will not align
my $IGNORE = 0; # This is a side comment
# This is a hanging side comment
# And so is this
# abbreviation, so we can't use it.
delete $hashref->{$abbrev};
}
-else { # We're the third word to have this
- # abbreviation, so skip to the next word.
+else { # We're the third word to have this
+ # abbreviation, so skip to the next word.
next WORD;
}
#8...........