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:
parent
d247b17999
commit
60673c2fb3
1 changed files with 12 additions and 7 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue