BugFix for trimmed paragraphs losing indentation

This commit is contained in:
Vitor Pamplona
2023-06-29 16:46:44 -04:00
parent b2cdc2ddef
commit e6f122d8b7
@@ -162,9 +162,9 @@ private fun RenderParagraph(
) { ) {
val s = remember(paragraph) { val s = remember(paragraph) {
if (isArabic(paragraph)) { if (isArabic(paragraph)) {
paragraph.trim().split(' ').reversed().toImmutableList() paragraph.split(' ').reversed().toImmutableList()
} else { } else {
paragraph.trim().split(' ').toImmutableList() paragraph.split(' ').toImmutableList()
} }
} }
@@ -236,6 +236,9 @@ private fun RenderWord(
tags: ImmutableListOfLists<String> tags: ImmutableListOfLists<String>
) { ) {
val type = remember(word) { val type = remember(word) {
if (word == "") {
WordType.OTHER
}
if (state.imagesForPager[word] != null) { if (state.imagesForPager[word] != null) {
WordType.IMAGE WordType.IMAGE
} else if (state.urlSet.contains(word)) { } else if (state.urlSet.contains(word)) {
@@ -799,6 +802,7 @@ data class HashWordWithExtra(val hashtag: String, val extras: String?)
fun HashTag(word: String, nav: (String) -> Unit) { fun HashTag(word: String, nav: (String) -> Unit) {
var tagSuffixPair by remember { mutableStateOf<HashWordWithExtra?>(null) } var tagSuffixPair by remember { mutableStateOf<HashWordWithExtra?>(null) }
if (tagSuffixPair == null) {
LaunchedEffect(key1 = word) { LaunchedEffect(key1 = word) {
launch(Dispatchers.IO) { launch(Dispatchers.IO) {
val hashtagMatcher = hashTagsPattern.matcher(word) val hashtagMatcher = hashTagsPattern.matcher(word)
@@ -818,6 +822,7 @@ fun HashTag(word: String, nav: (String) -> Unit) {
} }
} }
} }
}
Crossfade(targetState = tagSuffixPair) { Crossfade(targetState = tagSuffixPair) {
if (it != null) { if (it != null) {