Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions man/join_else_transform.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
\alias{join_else_transform}
\title{Join Else to Preceding Close Brace}
\usage{
join_else_transform(terms)
join_else_transform(terms, indent_str, line_limit)
}
\arguments{
\item{terms}{Enriched terminal DataFrame.}

\item{indent_str}{Indent string for line width calculation.}

\item{line_limit}{Maximum line width.}
}
\value{
Updated DataFrame.
}
\description{
AST transform that moves ELSE tokens (and any following opening brace)
to the same output line as the preceding `\}`. Skips if a COMMENT
exists between `\}` and `else`.
AST transform that moves ELSE tokens (and any following tokens on the
same line, like `if` in `else if`) to the same output line as the
preceding `\}`. Skips if a COMMENT exists between `\}` and `else`,
or if joining would exceed the line limit.
}
\keyword{internal}
2 changes: 1 addition & 1 deletion src/ifelse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void expand_call_if_args(std::vector<Token>& tokens, const FormatOptions& opts)
tokens[else_idx].out_order - 0.5));
tokens.push_back(make_token("'{'", "{", base_line + 2,
tokens[else_idx].out_order + 0.5));
int false_first_order = (false_start < n) ?
double false_first_order = (false_start < n) ?
tokens[false_start].out_order - 0.5 : 0.5;
tokens.push_back(make_token("'}'", "}", base_line + 4,
false_first_order));
Expand Down