Remove spaces at end of line before removing multiple new lines (#5928)

This commit is contained in:
Andreas 2021-09-18 21:16:03 +02:00 committed by GitHub
parent 3664195c71
commit 45fad147bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -365,10 +365,12 @@ class MangaInfoHeaderAdapter(
} }
} }
private fun updateDescription(description: String?, isCurrentlyExpanded: Boolean): CharSequence? { private fun updateDescription(description: String?, isCurrentlyExpanded: Boolean): CharSequence {
return when { return when {
description.isNullOrBlank() -> view.context.getString(R.string.unknown) description.isNullOrBlank() -> view.context.getString(R.string.unknown)
isCurrentlyExpanded -> description.replace(Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)), "\n") isCurrentlyExpanded -> description
.replace(Regex(" +\$", setOf(RegexOption.MULTILINE)), "")
.replace(Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)), "\n")
else -> description else -> description
} }
} }