Skip to content

Commit 6d5a670

Browse files
exclude unary plus from ggplot2 rule.
1 parent 193e772 commit 6d5a670

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/rules-line-break.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ remove_line_break_in_fun_call <- function(pd, strict) {
286286

287287

288288
set_linebreak_after_ggplot2_plus <- function(pd) {
289-
is_plus_raw <- pd$token == "'+'"
289+
# if expression is unary, first token is +. Exclude this case.
290+
is_plus_raw <- c(FALSE, pd$token[-1] == "'+'")
290291
if (any(is_plus_raw)) {
291292
first_plus <- which(is_plus_raw)[1]
292293
next_non_comment <- next_non_comment(pd, first_plus)

0 commit comments

Comments
 (0)