Skip to content

Commit

Permalink
autodoc: Fixup signature arglist indentation
Browse files Browse the repository at this point in the history
Somehow this got removed from eabcc81.
It affects only a few edge cases.  For example, before this, perlapi had
these lines,

 void       sv_vcatpvfn           (SV * const sv,
                                       const char * const pat,
                                       const STRLEN patlen,
                                       ...

 where the first argument to the function  was misaligned with the
 others.  This patch produces instead:

 void       sv_vcatpvfn           (    SV * const sv,
                                       const char * const pat,
                                       const STRLEN patlen,
                                       ...
  • Loading branch information
khwilliamson committed Jul 29, 2024
1 parent 963e0b1 commit 5a55277
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions autodoc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2036,12 +2036,11 @@ ($$$)
- $usage_max_width;

# Outdent if necessary
if ($excess_width > 0) {
$hanging_indent -= $excess_width;
}
elsif ( $any_has_pTHX_
&& $element->{args}->@*
&& ! $element->{has_pTHX}) {
$hanging_indent -= $excess_width if $excess_width > 0;

if ( $any_has_pTHX_
&& $element->{args}->@*
&& ! $element->{has_pTHX}) {

# If this item has arguments but not a pTHX, but
# others do, indent the args for this one so that
Expand All @@ -2052,8 +2051,21 @@ ($$$)
#
# void Perl_deb (pTHX_ const char *pat, ...)
# void deb_nocontext( const char *pat, ...)
$running_length += 6;
push @usage, " " x 6;
#
# But, don't indent the full amount if any next lines
# would begin before that amount. That leaves
# all lines indented to the same amount. -1 to
# account for the left parenthesis
if ($running_length + 6 - 1 <= $hanging_indent) {
push @usage, " " x 6;
$running_length += 6;
}
elsif ($running_length < $hanging_indent) {
push @usage, (" " x ( 1
+ $hanging_indent
- $running_length));
$running_length = $hanging_indent;
}
}

# Go through the argument list. Calculate how much space
Expand Down

0 comments on commit 5a55277

Please sign in to comment.