"To raw string literal" intention: fix false negative with string content starts with newline symbol \n

#KT-36369 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-02-06 10:30:31 +09:00
committed by Mikhail Glukhikh
parent 61d02d9ecb
commit 8baba38099
3 changed files with 3 additions and 2 deletions
@@ -82,7 +82,7 @@ class ToRawStringLiteralIntention : SelfTargetingOffsetIndependentIntention<KtSt
} }
private fun hasTrailingSpaces(text: String): Boolean { private fun hasTrailingSpaces(text: String): Boolean {
var afterSpace = true var afterSpace = false
for (c in text) { for (c in text) {
if ((c == '\n' || c == '\r') && afterSpace) return true if ((c == '\n' || c == '\r') && afterSpace) return true
afterSpace = c == ' ' || c == '\t' afterSpace = c == ' ' || c == '\t'
@@ -1,2 +1 @@
// IS_APPLICABLE: false
val v = <caret>"\n Hello, world!" val v = <caret>"\n Hello, world!"
@@ -0,0 +1,2 @@
val v = """
Hello, world!"""