diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt index 34055ecbc..cb2ccfe7f 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt @@ -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() } }