## 2024 09 03.06
+ - Added parameter --indent-leading-semicolon, -ils; see git #171. When
+ this is negated, a line with a leading semicolon does not get the extra
+ leading continuation indentation spaces (defined with -ci=n).
+
- Space around here doc delimiters follow spacing controls better. For
example, a space is now added before the closing paren here:
The default is not to do this, indicated by B<-nicb>.
+=item B<-ils>, B<--indent-leading-semicolon>
+
+A line which begins with a leading semicolon will, by default, have the extra
+number of indentation spaces defined by B<--continuation-indentation=n>.
+This extra indentation can be removed by setting B<-nils>.
+
+ # default
+ $z = sqrt( $x**2 + $y**2 )
+
+ ; # <-- indented by ci spaces
+
+ # -nils
+ $z = sqrt( $x**2 + $y**2 )
+
+ ; # <-- not indented by ci spaces
+
+Note that leading semicolons do not normally occur unless requested with
+B<--break-at-old-semicolon-breakpoints> or forced, for example by
+a blank line as in this example.
=item B<-nib>, B<--non-indenting-braces>
$z = sqrt( $x**2 + $y**2 );
-The result using B<perltidy -bos> keeps the isolated semicolon:
+Using the <-bos> flag keeps the isolated semicolon:
+ # perltidy -bos
$z = sqrt( $x**2 + $y**2 )
;
+The extra continuation indentation spaces on the semicolon can be
+removed by also setting B<--noindent-leading-semicolon>.
+
+ # perltidy -bos -nils
+ $z = sqrt( $x**2 + $y**2 )
+ ;
+
The default is not to do this, B<-nbos>.
$add_option->( 'outdent-labels', 'ola', '!' );
$add_option->( 'outdent-long-quotes', 'olq', '!' );
$add_option->( 'indent-closing-brace', 'icb', '!' );
+ $add_option->( 'indent-leading-semicolon', 'ils', '!' );
$add_option->( 'closing-token-indentation', 'cti', '=i' );
$add_option->( 'closing-paren-indentation', 'cpi', '=i' );
$add_option->( 'closing-brace-indentation', 'cbi', '=i' );
hanging-side-comments
indent-block-comments
indent-columns=4
+ indent-leading-semicolon
integer-range-check=2
interbracket-arrow-complexity=1
iterations=1
$rOpts_ignore_perlcritic_comments,
$rOpts_indent_closing_brace,
$rOpts_indent_columns,
+ $rOpts_indent_leading_semicolon,
$rOpts_indent_only,
$rOpts_keep_interior_semicolons,
$rOpts_line_up_parentheses,
$rOpts_ignore_perlcritic_comments = $rOpts->{'ignore-perlcritic-comments'};
$rOpts_indent_closing_brace = $rOpts->{'indent-closing-brace'};
$rOpts_indent_columns = $rOpts->{'indent-columns'};
+ $rOpts_indent_leading_semicolon = $rOpts->{'indent-leading-semicolon'};
$rOpts_indent_only = $rOpts->{'indent-only'};
$rOpts_keep_interior_semicolons = $rOpts->{'keep-interior-semicolons'};
$rOpts_line_up_parentheses = $rOpts->{'line-up-parentheses'};
);
}
+ #-----------------------------------------
+ # Section 1B:
+ # if line starts with a non-sequenced item
+ #-----------------------------------------
+ else {
+ if ( $type_beg eq ';' && !$rOpts_indent_leading_semicolon ) {
+ $adjust_indentation = 1;
+ }
+ }
+
#---------------------------------------------------------
# Section 2: set indentation according to flag set above
#
--- /dev/null
+$z = sqrt( $x**2 + $y**2 );
--- /dev/null
+$z = sqrt( $x**2 + $y**2 )
+;
--- /dev/null
+$z = sqrt( $x**2 + $y**2 )
+;
--- /dev/null
+-nils -bos
../snippets31.t btct.btct2
../snippets31.t btct.btct3
../snippets31.t btct.def
+../snippets31.t c424.c424
+../snippets31.t c424.def
../snippets4.t gnu1.gnu
../snippets4.t gnu2.def
../snippets4.t gnu2.gnu
../snippets9.t rt98902.def
../snippets9.t rt98902.rt98902
../snippets9.t rt99961.def
-../snippets31.t c424.c424
-../snippets31.t c424.def
+../snippets31.t ils.def
+../snippets31.t ils.ils
#3 btct.def
#4 c424.c424
#5 c424.def
+#6 ils.def
+#7 ils.ils
# To locate test #13 you can search for its name or the string '#13'
'btct3' => "-btct=1 -atc -wtc=1",
'c424' => "-naws -qwaf",
'def' => "",
+ 'ils' => "-nils -bos",
};
############################
'c424' => <<'----------',
my @chars = qw( | / - \ | / - \ );
my @chars = qw(| / - \ | / - \ );
+----------
+
+ 'ils' => <<'----------',
+$z = sqrt( $x**2 + $y**2 )
+;
----------
};
my @chars = qw(| / - \ | / - \ );
#5...........
},
+
+ 'ils.def' => {
+ source => "ils",
+ params => "def",
+ expect => <<'#6...........',
+$z = sqrt( $x**2 + $y**2 );
+#6...........
+ },
+
+ 'ils.ils' => {
+ source => "ils",
+ params => "ils",
+ expect => <<'#7...........',
+$z = sqrt( $x**2 + $y**2 )
+;
+#7...........
+ },
};
my $ntests = 0 + keys %{$rtests};