}
%container_indentation_options = ();
- for ( $rOpts->{'break-before-hash-brace-and-indent'} ) {
- my $tok = '{';
- if ( defined($_) && $_ > 0 && $break_before_container_types{$tok} ) {
- $container_indentation_options{$tok} = $_;
- }
- }
- for ( $rOpts->{'break-before-square-bracket-and-indent'} ) {
- my $tok = '[';
- if ( defined($_) && $_ > 0 && $break_before_container_types{$tok} ) {
- $container_indentation_options{$tok} = $_;
- }
- }
- for ( $rOpts->{'break-before-paren-and-indent'} ) {
- my $tok = '(';
- if ( defined($_) && $_ > 0 && $break_before_container_types{$tok} ) {
- $container_indentation_options{$tok} = $_;
+ foreach my $pair (
+ [ 'break-before-hash-brace-and-indent', '{' ],
+ [ 'break-before-square-bracket-and-indent', '[' ],
+ [ 'break-before-paren-and-indent', '(' ],
+ )
+ {
+ my ( $key, $tok ) = @{$pair};
+ my $opt = $rOpts->{$key};
+ if ( defined($opt) && $opt > 0 && $break_before_container_types{$tok} )
+ {
+
+ # -lp is not compatable with opt=3, silently set to opt=0
+ if ( $rOpts->{'line-up-parentheses'} && $opt == 2 ) { $opt = 0 }
+ $container_indentation_options{$tok} = $opt;
}
}
my $KK = $K_opening_container->{$seqno};
+ my $is_list = $self->is_list_by_seqno($seqno);
+ my $has_list = $rhas_broken_container->{$seqno};
+
# This must be a list (this will exclude all code blocks)
- next unless $self->is_list_by_seqno($seqno);
+ # or contain a list
+ next unless ( $is_list || $has_list );
# Only for types of container tokens with a non-default break option
my $token = $rLL->[$KK]->[_TOKEN_];
# - this list contains a broken container, or
# - this list is contained in a broken list
elsif ( $break_option == 2 ) {
- my $ok_to_break = $rhas_broken_container->{$seqno};
+ my $ok_to_break = $has_list;
if ( !$ok_to_break ) {
my $parent = $rparent_of_seqno->{$seqno};
$ok_to_break = $self->is_list_by_seqno($parent);
=over 4
+=item B<reset -bbxi=2 to -bbxi=0 if -lp is set to avoid blinking states>
+
+The options of the form bbxi=2, such as break-before-paren-and-indent=2, have
+been found to cause blinking states if the -lp flag is set. Both of these
+options are fairly rare. To correct this the -bbxi=2 flag is now reset to
+-bbxi=0 if the -lp flag is set. Note that -bbxi=2 and -bbxi=0 give the same
+formatting result with the common setting -ci=4 and -i=4.
+
+The following cases were fixed with this update:
+
+b396 b397 b398 b429 b435 b457 b502 b503 b504 b505 b538 b540 b542 b617 b618 b619
+b620 b621
+
+3 Feb 2021.
+
=item B<rewrite sub break_before_list_opening_containers>
sub break_before_list_opening_containers was rewritten to reduce the chance