diff --git a/R/rules-line-breaks.R b/R/rules-line-breaks.R index 0a7d3881b..b3def4244 100644 --- a/R/rules-line-breaks.R +++ b/R/rules-line-breaks.R @@ -231,13 +231,14 @@ remove_line_break_before_round_closing_after_curly <- function(pd) { remove_line_breaks_in_fun_dec <- function(pd) { if (is_function_declaration(pd)) { + is_double_indention <- is_double_indent_function_declaration(pd) round_after <- ( pd$token == "')'" | pd$token_before == "'('" ) & pd$token_before != "COMMENT" pd$lag_newlines[pd$lag_newlines > 1L] <- 1L pd$lag_newlines[round_after] <- 0L - if (is_double_indent_function_declaration(pd)) { + if (is_double_indention) { pd$lag_newlines[lag(pd$token == "'('")] <- 1L } } diff --git a/tests/testthat/unindention/mixed-double-out.R b/tests/testthat/unindention/mixed-double-out.R index 669e14578..a1c7e24d2 100644 --- a/tests/testthat/unindention/mixed-double-out.R +++ b/tests/testthat/unindention/mixed-double-out.R @@ -58,7 +58,8 @@ function( } -function(x, y) { +function( + x, y) { 1 } @@ -70,9 +71,15 @@ function(x, # last brace -function(x, y) NULL +function( + x, y) { + NULL +} -function(x, y) NULL +function( + x, y) { + NULL +} function( x,