From 45fad147bfcc10d0fcece135d2196e74bda4a15e Mon Sep 17 00:00:00 2001 From: Andreas Date: Sat, 18 Sep 2021 21:16:03 +0200 Subject: [PATCH] Remove spaces at end of line before removing multiple new lines (#5928) --- .../tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt index 8438fda80e..67d0468627 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt @@ -365,10 +365,12 @@ class MangaInfoHeaderAdapter( } } - private fun updateDescription(description: String?, isCurrentlyExpanded: Boolean): CharSequence? { + private fun updateDescription(description: String?, isCurrentlyExpanded: Boolean): CharSequence { return when { 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 } }