Skip to content

Commit 0935242

Browse files
Fix indent indices computation with multiple braces
If braces to if-else statements and the result contained a brace which(pd$token %in% token_closing=[needs_indention]) yielded two numbers. Since the brace expression is not added in a new expression, but the braces are added around the current expression in a nest, the expression may contain pairs of braces.
1 parent 6084667 commit 0935242

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/modify_pd.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ compute_indent_indices <- function(pd,
129129
if (is.null(token_closing)) {
130130
stop <- npd
131131
} else {
132-
stop <- which(pd$token %in% token_closing) - 1
132+
stop <- last(which(pd$token %in% token_closing)[needs_indention]) - 1
133133
}
134134

135135
seq2(start, stop)

0 commit comments

Comments
 (0)