Skip to content

Commit 60f675c

Browse files
makenowjustRX14
authored andcommittedApr 2, 2018
Format: fix indentation after backslash newline (#5901)
#5892 (comment)
1 parent 4d2ad83 commit 60f675c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
 

Diff for: ‎spec/compiler/formatter/formatter_spec.cr

+2
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,8 @@ describe Crystal::Formatter do
11041104
assert_format "1 \\\nensure 2", "1 \\\n ensure 2"
11051105
assert_format "foo bar, \\\nbaz", "foo bar,\n baz"
11061106
assert_format "x 1, \\\n 2", "x 1,\n 2"
1107+
assert_format "begin\n 1 + \\\n 2\n 3\nend"
1108+
assert_format "begin\n 1 \\\n + 2\n 3\nend"
11071109

11081110
assert_format "alias X = ((Y, Z) ->)"
11091111

Diff for: ‎src/compiler/crystal/tools/formatter.cr

+1
Original file line numberDiff line numberDiff line change
@@ -4327,6 +4327,7 @@ module Crystal
43274327
old_indent = @indent
43284328
@indent = indent
43294329
value = yield
4330+
@passed_backslash_newline = false
43304331
@indent = old_indent
43314332
value
43324333
end

0 commit comments

Comments
 (0)