From 9ac1dc01cb6d37eaa886433e64398001c13d84b7 Mon Sep 17 00:00:00 2001 From: arcade_kappa Date: Tue, 2 Apr 2024 15:42:23 +0800 Subject: [PATCH] Should fix wrap in format --- src/main/java/gkappa/wrapfix/mixin/MixinFontRenderer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/gkappa/wrapfix/mixin/MixinFontRenderer.java b/src/main/java/gkappa/wrapfix/mixin/MixinFontRenderer.java index ac08485..90786f0 100644 --- a/src/main/java/gkappa/wrapfix/mixin/MixinFontRenderer.java +++ b/src/main/java/gkappa/wrapfix/mixin/MixinFontRenderer.java @@ -86,7 +86,9 @@ private void wrapStringToWidthICU4J(String str, int wrapWidth, CallbackInfoRetur format.append('§').append(f); // Add to current format code line.append('§').append(f); widths[i - fed] = lineWidth; + widths[i - fed + 1] = lineWidth; formats[i - fed] = format.toString(); + formats[i - fed + 1] = format.toString(); i++; continue; } @@ -115,7 +117,7 @@ private void wrapStringToWidthICU4J(String str, int wrapWidth, CallbackInfoRetur lineWidth = getCharWidth(current); } else { d = icui - fed; - if (line.charAt(d + prevFormat - 1) == '§') WrapFix.logger.info("{} {} {}", line, d + prevFormat, list.toString()); + if (line.charAt(d + prevFormat - 1) == '§') d--; list.add(line.substring(0, d + prevFormat)); temp = line.substring(d + prevFormat); fed = icui;