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:
committed by
Ilya Gorbunov
parent
36975786e8
commit
7a538accff
@@ -83,7 +83,7 @@ public inline fun String.trimStart(predicate: (Char) -> Boolean): String
|
|||||||
public inline fun CharSequence.trimEnd(predicate: (Char) -> Boolean): CharSequence {
|
public inline fun CharSequence.trimEnd(predicate: (Char) -> Boolean): CharSequence {
|
||||||
for (index in this.indices.reversed())
|
for (index in this.indices.reversed())
|
||||||
if (!predicate(this[index]))
|
if (!predicate(this[index]))
|
||||||
return substring(0, index + 1)
|
return subSequence(0, index + 1)
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user