mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-10-26 14:24:07 +00:00
Correctly crop colored text (#839)
This commit is contained in:
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;
|
||||
|
||||
Reference in new issue
Block a user