]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix issue b1220
authorSteve Hancock <perltidy@users.sourceforge.net>
Fri, 1 Oct 2021 00:30:47 +0000 (17:30 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Fri, 1 Oct 2021 00:30:47 +0000 (17:30 -0700)
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

index 50c85f78948fa49580d1b481a691b1ad720540e0..08ddc1b55522952850b8c0d4edb7dcf5352a9766 100644 (file)
@@ -7477,6 +7477,29 @@ is( Koha::Acquisition::Funds->search->count,
 --maximum-line-length=50
 --variable-maximum-line-length
 
+==> b1220.in <==
+# S1
+print$msg,
+ "\n",
+ '-' x
+ length$msg,
+ "\n";
+
+# S2
+print$msg,
+ "\n",
+ '-'
+ x length
+ $msg,
+ "\n";
+
+==> b1220.par <==
+--noadd-whitespace
+--break-at-old-comma-breakpoints
+--break-before-all-operators
+--continuation-indentation=1
+--maximum-line-length=12
+
 ==> b131.in <==
         unless
           ( open( SCORE, "+>>$Score_File" ) )
index 753688b0a480e6151fdbfc99a4c7487976f45e6f..f32e6c89b6b87e48b3da440686f13cb61b087d0c 100644 (file)
@@ -16709,7 +16709,10 @@ sub set_continuation_breaks {
         # (3) NEW: there are one or more old comma breaks (see return example)
         # (4) the first comma is at the starting level ...
         #     ... fixes cases b064 b065 b068 b210 b747
-        #
+        # (5) the batch does not start with a ci>0 [ignore a ci change by -xci]
+        #     ... fixes b1220.  If ci>0 we are in the middle of a snippet,
+        #     maybe because -boc has been forcing out previous lines.
+
         # For example, we will follow the user and break after
         # 'print' in this snippet:
         #    print
@@ -16737,7 +16740,15 @@ sub set_continuation_breaks {
         #
         my $i_first_comma = $comma_index[$dd]->[0];
         my $level_comma   = $levels_to_go[$i_first_comma];
-        if (   $old_breakpoint_to_go[$i_first_comma]
+        my $ci_start      = $ci_levels_to_go[0];
+
+        # Here we want to use the value of ci before any -xci adjustment
+        if ( $ci_start && $rOpts_extended_continuation_indentation ) {
+            my $K0 = $K_to_go[0];
+            if ( $self->[_rseqno_controlling_my_ci_]->{$K0} ) { $ci_start = 0 }
+        }
+        if (  !$ci_start
+            && $old_breakpoint_to_go[$i_first_comma]
             && $level_comma == $levels_to_go[0] )
         {
             my $ibreak    = -1;
@@ -16770,7 +16781,6 @@ sub set_continuation_breaks {
                     # Be sure to test any changes to these rules against runs
                     # with -l=0 such as the 'bbvt' test (perltidyrc_colin)
                     # series.
-
                     my $typem = $types_to_go[$ibreakm];
                     if ( !$is_uncontained_comma_break_excluded_type{$typem} ) {
                         $self->set_forced_breakpoint($ibreak);