diff --git a/Parser/SwiftParser.swift b/Parser/SwiftParser.swift index 3afc4fc..8327774 100644 --- a/Parser/SwiftParser.swift +++ b/Parser/SwiftParser.swift @@ -246,7 +246,9 @@ class SwiftParser { indent.inSwitch = true isNextSwitch = false } - retString = retString.trim() + indent.count -= 1 + trimWithIndent() + indent.count += 1 if !retString.last.isUpperBlock() { retString.keepSpace() } diff --git a/SwimatTests/tests/n-curly-new-line/after.swift b/SwimatTests/tests/n-curly-new-line/after.swift index 19c73b6..f2a49eb 100644 --- a/SwimatTests/tests/n-curly-new-line/after.swift +++ b/SwimatTests/tests/n-curly-new-line/after.swift @@ -1,5 +1,7 @@ // #182 -if condition -{ - expression() +if condition { + if condition + { + expression() + } } diff --git a/SwimatTests/tests/n-curly-new-line/before.swift b/SwimatTests/tests/n-curly-new-line/before.swift index 19c73b6..f2a49eb 100644 --- a/SwimatTests/tests/n-curly-new-line/before.swift +++ b/SwimatTests/tests/n-curly-new-line/before.swift @@ -1,5 +1,7 @@ // #182 -if condition -{ - expression() +if condition { + if condition + { + expression() + } }