From 4517ce588431fc6080bad24d947c53c8d82fcaa0 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 9 Feb 2017 17:14:34 +0300 Subject: Removed leading newline --- core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'core/src/main') diff --git a/core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt b/core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt index e9cf5e18..1eb0c114 100644 --- a/core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt +++ b/core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt @@ -42,9 +42,8 @@ open class DefaultSampleProcessingService return ContentBlockSampleCode().apply { append(ContentText("//Source not found: $functionName")) } } - val text = processSampleBody(psiElement) - - val lines = text.trimEnd().split("\n") + val text = processSampleBody(psiElement).trim { it == '\n' || it == '\r' }.trimEnd() + val lines = text.split("\n") val indent = lines.filter(String::isNotBlank).map { it.takeWhile(Char::isWhitespace).count() }.min() ?: 0 val finalText = lines.map { it.drop(indent) }.joinToString("\n") -- cgit