Browse Source

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

Andreas 3 years ago
parent
commit
45fad147bf

+ 4 - 2
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
             }
         }