Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ open class UIWrappedText @JvmOverloads constructor(
return super.draw(matrixStack)
}

if (width / textScale <= charWidth) {
// If we are smaller than a char, we can't physically split this string into
// "width" strings, so we'll prefer a no-op to an error.
return super.draw(matrixStack)
}

UGraphics.enableBlend()

val lines = if (trimText) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/gg/essential/elementa/utils/text.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ fun getStringSplitToWidth(
pushLine()

for (char in word.toCharArray()) {
if ((currLine.toString() + char).width(textScale, fontProvider) > maxLineWidthSpace)
if (currLine.isNotEmpty() && (currLine.toString() + char).width(textScale, fontProvider) > maxLineWidthSpace)
pushLine()
currLine.append(char)
}
Expand Down