Skip to content

Commit

Permalink
TextComponent: Correctly parse Texts
Browse files Browse the repository at this point in the history
This now correctly adds siblings of the text
  • Loading branch information
camnwalter committed Mar 19, 2024
1 parent 658d20a commit f9e5463
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,16 @@ class TextComponent private constructor(
}
is Part -> listOf(obj)
is TextComponent -> obj.parts
is Text -> listOf(Part(obj.string, obj.style))
is Text -> {
val parts = mutableListOf<Part>()

obj.content.visit({ style, text ->
parts.add(Part(text, style))
Optional.empty<Any>()
}, obj.style)

parts + obj.siblings.flatMap(::of)
}
is CharSequence -> {
val parts = mutableListOf<Part>()
val builder = StringBuilder()
Expand Down

0 comments on commit f9e5463

Please sign in to comment.