diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index aeebdbfd3c..6b147ffa58 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -1723,6 +1723,11 @@ fn stmt_is_single_line(stmt ast.Stmt) bool { fn expr_is_single_line(expr ast.Expr) bool { match expr { + ast.AnonFn { + if !expr.decl.no_body { + return false + } + } ast.IfExpr { return false } diff --git a/vlib/v/fmt/tests/fn_trailing_arg_syntax_keep.vv b/vlib/v/fmt/tests/fn_trailing_arg_syntax_keep.vv index 5df0249dcd..cf0f3a08c1 100644 --- a/vlib/v/fmt/tests/fn_trailing_arg_syntax_keep.vv +++ b/vlib/v/fmt/tests/fn_trailing_arg_syntax_keep.vv @@ -35,6 +35,12 @@ fn main() { f: 'here' } ) + ui.button( + width: 70 + onclick: fn (a voidptr, b voidptr) { + webview.new_window(url: 'https://vlang.io', title: 'The V programming language') + } + ) } fn bar_func(bar Bar) {