fix toots showing too much whitespace (#1761)
* fix toots showing too much whitespace * use isWhitespace extension function
This commit is contained in:
parent
bbd31d5ba4
commit
89efd67015
5 changed files with 53 additions and 63 deletions
|
@ -2,7 +2,8 @@
|
|||
|
||||
package com.keylesspalace.tusky.util
|
||||
|
||||
import java.util.Random
|
||||
import android.text.Spanned
|
||||
import java.util.*
|
||||
|
||||
|
||||
private const val POSSIBLE_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
@ -71,3 +72,11 @@ fun String.isLessThan(other: String): Boolean {
|
|||
else -> this < other
|
||||
}
|
||||
}
|
||||
|
||||
fun Spanned.trimTrailingWhitespace(): Spanned {
|
||||
var i = length
|
||||
do {
|
||||
i--
|
||||
} while (i >= 0 && get(i).isWhitespace())
|
||||
return subSequence(0, i + 1) as Spanned
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue