diff --git a/spec/compiler/formatter/formatter_spec.cr b/spec/compiler/formatter/formatter_spec.cr index a5b03dfe1f34..e7b3170d89ad 100644 --- a/spec/compiler/formatter/formatter_spec.cr +++ b/spec/compiler/formatter/formatter_spec.cr @@ -1104,6 +1104,8 @@ describe Crystal::Formatter do assert_format "1 \\\nensure 2", "1 \\\n ensure 2" assert_format "foo bar, \\\nbaz", "foo bar,\n baz" assert_format "x 1, \\\n 2", "x 1,\n 2" + assert_format "begin\n 1 + \\\n 2\n 3\nend" + assert_format "begin\n 1 \\\n + 2\n 3\nend" assert_format "alias X = ((Y, Z) ->)" diff --git a/src/compiler/crystal/tools/formatter.cr b/src/compiler/crystal/tools/formatter.cr index 569f2594908d..29af281c1070 100644 --- a/src/compiler/crystal/tools/formatter.cr +++ b/src/compiler/crystal/tools/formatter.cr @@ -4327,6 +4327,7 @@ module Crystal old_indent = @indent @indent = indent value = yield + @passed_backslash_newline = false @indent = old_indent value end