--maximum-line-length=42
--weld-nested-containers
+==> b1197.in <==
+# S1
+if (
+ compare ( "$file.new",
+ $file ) )
+
+# S2
+if (
+ compare ("$file.new", $file ) )
+
+==> b1197.par <==
+--continuation-indentation=10
+--extended-continuation-indentation
+--indent-columns=9
+--maximum-line-length=48
+--paren-vertical-tightness-closing=1
+--paren-vertical-tightness=1
+--space-function-paren
+
+==> b1198.in <==
+if (
+ open( SH, '<', "${outdir}config_h.SH" ) )
+
+if (
+ open( SH, '<',
+ "${outdir}config_h.SH" ) )
+
+==> b1198.par <==
+--continuation-indentation=10
+--extended-continuation-indentation
+--indent-columns=9
+--maximum-line-length=48
+--paren-vertical-tightness-closing=1
+--variable-maximum-line-length
+
+==> b1199.in <==
+ if (
+ open( CONFIG_H_SH, '<',
+ 'config_h.SH' ) )
+
+ if (
+ open( CONFIG_H_SH, '<', 'config_h.SH' ) )
+
+==> b1199.par <==
+--continuation-indentation=10
+--extended-continuation-indentation
+--indent-columns=9
+--maximum-line-length=48
+--paren-vertical-tightness-closing=1
+--variable-maximum-line-length
+
==> b120.in <==
# Same as bug96
# State 1
--line-up-parentheses
--space-terminal-semicolon
+==> b1202.in <==
+ $_res = (
+ $severity_host_count{
+ $b}
+ <=> $severity_host_count{
+ $a}
+ );
+
+ $_res =
+ ( $severity_host_count{$b}
+ <=> $severity_host_count{$a}
+ );
+
+==> b1202.par <==
+--continuation-indentation=9
+--extended-continuation-indentation
+--indent-columns=6
+--line-up-parentheses
+--maximum-line-length=47
+
+==> b1203.in <==
+ if(
+ !$found
+ &&$word
+ &&(($ref_info=
+ $references{$word})) )
+
+ if(
+ !$found
+ &&$word
+ &&((
+ $ref_info=$references{
+ $word} )) )
+
+==> b1203.par <==
+--noadd-whitespace
+--delete-old-whitespace
+--indent-columns=6
+--maximum-line-length=69
+--paren-vertical-tightness-closing=1
+--weld-nested-containers
+
+==> b1205.in <==
+# S1 (x was being misparsed as a function call)
+ print $" x( 27 - @| ) . $. . $" x 5;
+
+# S2
+ print $" x ( 27 - @| ) . $. . $" x 5;
+
+==> b1205.par <==
+--nowant-right-space='x'
+--space-function-paren
+
==> b131.in <==
unless
( open( SCORE, "+>>$Score_File" ) )
# from level.
@maximum_line_length_at_level,
@maximum_text_length_at_level,
+ $stress_level,
# Total number of sequence items in a weld, for quick checks
$total_weld_count,
}
}
+ # Find a '$stress_level' = an estimated indentation level at which
+ # indentation starts to be under stress.
+ my $denom = max( 1, $rOpts_indent_columns );
+
+ # Define a fixed number of spaces for a typical variable.
+ # Cases b1197-b1204 work ok with const=12 but not with const=8
+ my $const = 16;
+ $stress_level = 0;
+ foreach my $level ( 0 .. $level_max ) {
+ my $remaining_cycles = max(
+ 0,
+ (
+ $maximum_text_length_at_level[$level] -
+ $rOpts_continuation_indentation - $const
+ ) / $denom
+ );
+ last if ( $remaining_cycles <= 3 ); # 2 does not work
+ $stress_level = $level;
+ }
+
initialize_weld_nested_exclusion_rules($rOpts);
initialize_line_up_parentheses_exclusion_rules($rOpts);
return;
$maximum_text_length_at_level[$level] -
$ci_level * $rOpts_continuation_indentation;
+ # Fix for b1197 b1198 b1199 b1200 b1201 b1202
+ # Do not apply -xci if we are running out of space
+ if ( $level >= $stress_level ) {
+ DEBUG_XCI
+ && print
+"XCI: Skipping seqno=$seqno, level=$level exceeds stress level=$stress_level\n";
+ next;
+ }
+
# remember how much space is available for patch b1031 above
my $space =
$maximum_text_length - $len_tol - $rOpts_continuation_indentation;
$cab_flag = 5;
}
+ # Ignore old breakpoints when under stress.
+ # Fixes b1203 b1204 as well as b1197-b1200.
+ if ( $levels_to_go[$i_opening] >= $stress_level ) {
+ $cab_flag = 2;
+ }
+
if ( !$is_long_term
&& $saw_opening_structure
&& $is_opening_token{ $tokens_to_go[$i_opening] }
=over 4
+=item B<Use stress_level to fix cases b1197-b1204>
+
+Testing with random input parameters produced a number of cases of unstable
+formatting. All of these involved some combination of a short maximum line
+length, a large -ci and -i, and often one or more of -xci -lp and -wn. These
+parameters can force lines to break at poor locations. All of these cases were
+fixed by introducing a quantity called the 'stress_level', which is the
+approximate indentation level at which the line break logic comes under high
+stress and become unstable. For default parameters the stress level is about
+12, but unusual parameter combinations can make it much less, even as low as
+zero. For code which is at an indentation level greater than this depth, some
+defensive actions are taken to avoid instability, such as temporarily turning
+off the -xci flag when the indentation depth exceeds the stress level. Most
+actual working code will not be influenced by this logic. Actual code which
+has a very deep indentation level can avoid problems by using a long line
+length, a short number of indentation spaces, or even the whitespace-cycle
+parameter.
+
+This update fixes issues b1197 b1198 b1199 b1200 b1201 b1202 b1203 b1204
+
+12 Sep 2021.
+
=item B<Fix unusual hanging side comment issue, c070>
This issues can be illustrated with the following input script:
This fixes issue c070.
-10 Sep 2021.
+10 Sep 2021, ec6ccf9.
=item B<Fix parsing issue c068>
This fixes issue c068.
-7 Sep 2021.
+7 Sep 2021, 9bc23d1.
=item B<Fix parsing problem issue c066>
Running perltidy generated a warning message which is caused by the lack of
space before the 'eq'. This update fixes the problem.
-4 Sep 2021.
+4 Sep 2021, df79a20.
=item B<Fix unusual parsing problem issue c065>
This fixes issue c065.
-4 Sep 2021.
+4 Sep 2021, f242f78.
=item B<Fix formatting instability issues b1195, b1196>
Testing with random parameters produced two similar cases of unstable
formatting which are fixed with this update.
-28 Aug 2021.
+28 Aug 2021, ab9ad39.
=item B<Fix formatting instability issue b1194>