1
0
Fork 0
mirror of https://github.com/Corewala/Buran synced 2024-12-22 07:42:43 +00:00

Fixed attention guide crash on non-alphanumeric words

This commit is contained in:
Corewala 2022-05-30 11:38:45 -04:00
parent d247b17999
commit 60673c2fb3

View file

@ -303,14 +303,19 @@ class GemtextAdapter(
.append("${component.substring(index)}$joiner")
} else {
var offset = 1
while (!component.substring(offset).first().isLetterOrDigit()) {
offset += 1
if (component.length - offset > 1) {
while (!component.substring(offset).first().isLetterOrDigit()) {
offset += 1
}
val index = (component.length - offset) / 2
attentionGuideText
.append(component.substring(0, offset))
.bold { append(component.substring(offset, index + offset)) }
.append("${component.substring(index + offset)}$joiner")
}else{
attentionGuideText.append("$component$joiner")
}
val index = (component.length - offset) / 2
attentionGuideText
.append(component.substring(0, offset))
.bold { append(component.substring(offset, index + offset)) }
.append("${component.substring(index + offset)}$joiner")
}
} else {
attentionGuideText.append("$component$joiner")