mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-06 18:43:04 +02:00
BugFix for trimmed paragraphs losing indentation
This commit is contained in:
@@ -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,21 +802,23 @@ 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) }
|
||||||
|
|
||||||
LaunchedEffect(key1 = word) {
|
if (tagSuffixPair == null) {
|
||||||
launch(Dispatchers.IO) {
|
LaunchedEffect(key1 = word) {
|
||||||
val hashtagMatcher = hashTagsPattern.matcher(word)
|
launch(Dispatchers.IO) {
|
||||||
|
val hashtagMatcher = hashTagsPattern.matcher(word)
|
||||||
|
|
||||||
val (myTag, mySuffix) = try {
|
val (myTag, mySuffix) = try {
|
||||||
hashtagMatcher.find()
|
hashtagMatcher.find()
|
||||||
Pair(hashtagMatcher.group(1), hashtagMatcher.group(2))
|
Pair(hashtagMatcher.group(1), hashtagMatcher.group(2))
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("Hashtag Parser", "Couldn't link hashtag $word", e)
|
Log.e("Hashtag Parser", "Couldn't link hashtag $word", e)
|
||||||
Pair(null, null)
|
Pair(null, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myTag != null) {
|
if (myTag != null) {
|
||||||
launch(Dispatchers.Main) {
|
launch(Dispatchers.Main) {
|
||||||
tagSuffixPair = HashWordWithExtra(myTag, mySuffix)
|
tagSuffixPair = HashWordWithExtra(myTag, mySuffix)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user