aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/textutil.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/util/textutil.kt')
-rw-r--r--src/main/kotlin/util/textutil.kt2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/kotlin/util/textutil.kt b/src/main/kotlin/util/textutil.kt
index 36924a6..1cef5d4 100644
--- a/src/main/kotlin/util/textutil.kt
+++ b/src/main/kotlin/util/textutil.kt
@@ -90,6 +90,8 @@ fun CharSequence.removeColorCodes(keepNonColorCodes: Boolean = false): String {
val Text.unformattedString: String
get() = string.removeColorCodes()
+val Text.directLiteralStringContent: String? get() = (this.content as? PlainTextContent)?.string()
+
fun Text.allSiblings(): List<Text> = listOf(this) + siblings.flatMap { it.allSiblings() }
fun MutableText.withColor(formatting: Formatting) = this.styled { it.withColor(formatting).withItalic(false) }