forked from StarOpenSource/Engine
Fix TwoCycleFormatterImpl parsing
This commit is contained in:
parent
048ae6b074
commit
01c91244aa
1 changed files with 9 additions and 0 deletions
|
@ -57,6 +57,7 @@ abstract class TwoCycleFormatterImpl: TwoCycleFormatter() {
|
|||
if (inTag) {
|
||||
if (char == '>') {
|
||||
inTag = false
|
||||
|
||||
if (currentComponent.isNotEmpty())
|
||||
when (currentComponent.toString()) {
|
||||
"reset" -> components.add("RESET")
|
||||
|
@ -64,6 +65,8 @@ abstract class TwoCycleFormatterImpl: TwoCycleFormatter() {
|
|||
"white", "black", "gray", "yellow", "green", "cyan", "light_blue", "blue", "purple", "magenta", "pink", "red", "orange" -> components.add("COLOR:${currentComponent.toString().uppercase()}")
|
||||
else -> components[components.lastIndex] = "${components[components.lastIndex]}<${currentComponent}>"
|
||||
}
|
||||
|
||||
currentComponent.clear()
|
||||
} else
|
||||
currentComponent.append(char)
|
||||
} else
|
||||
|
@ -80,11 +83,17 @@ abstract class TwoCycleFormatterImpl: TwoCycleFormatter() {
|
|||
currentComponent.append(char)
|
||||
} else
|
||||
inTag = true
|
||||
|
||||
if (currentComponent.isNotEmpty())
|
||||
components.add("TEXT:${currentComponent}")
|
||||
currentComponent.clear()
|
||||
}
|
||||
else -> currentComponent.append(char)
|
||||
}
|
||||
|
||||
if (currentComponent.isNotEmpty())
|
||||
components.add("TEXT:${currentComponent}")
|
||||
|
||||
return components.toTypedArray()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue