Fix problem with trimEnd wiping out spans in SpannableStringBuilder

If I pass in a CharSequence with different spans, the original trimEnd using substring incorrectly wiped out the spans.
changing to subSequence correctly preserves the span data

#KT-23920 Fixed
This commit is contained in:
J.T. Gilkeson
2018-04-17 17:06:35 -07:00
committed by Ilya Gorbunov
parent 36975786e8
commit 7a538accff
+1 -1
View File
@@ -83,7 +83,7 @@ public inline fun String.trimStart(predicate: (Char) -> Boolean): String
public inline fun CharSequence.trimEnd(predicate: (Char) -> Boolean): CharSequence {
for (index in this.indices.reversed())
if (!predicate(this[index]))
return substring(0, index + 1)
return subSequence(0, index + 1)
return ""
}