Correctly crop colored text (#839)

This commit is contained in:
slprime authored and GitHub committed 2026-01-13 15:16:09 +02:00
1 parent 463f4c9b60
commit e036fd14a8
1 file changed
+3 -10
@@ -413,18 +413,11 @@ public class NEIClientUtils extends NEIServerUtils {
if (textWidth > containerWidth) {
int dots = fontRenderer.getStringWidth("...");
if (containerWidth > dots) {
textWidth += dots;
while (textWidth > containerWidth) {
textWidth -= fontRenderer.getCharWidth(text.charAt(text.length() - 1));
text = text.substring(0, text.length() - 1);
}
return text + "...";
if (containerWidth <= dots) {
return "...";
}
return "...";
return fontRenderer.trimStringToWidth(text, containerWidth - dots) + "...";
}
return text;