Skip to content

Commit 7eaab85

Browse files
committed
fix: other highlighter bug
1 parent 133912f commit 7eaab85

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎src/main/java/dev/dfonline/codeclient/dev/highlighter/MiniMessageHighlighter.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ private void handle(Node node, String full, StringBuilder sb, AtomicInteger inde
101101
String closing = String.format("</%s>", tagName);
102102

103103
if (full.startsWith(closing, index.get())) {
104-
if (isActiveTag(tagNode)) {
105-
activeTags.remove(tagNode);
104+
int activeTagIndex = activeTags.indexOf(tagNode);
105+
if (activeTagIndex >= 0) {
106+
activeTags.subList(activeTagIndex, activeTags.size()).clear();
106107
}
107108

108109
index.addAndGet(closing.length());

‎src/main/java/dev/dfonline/codeclient/mixin/screen/chat/MEditBox.java‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ private FormattedCharSequence applyFormat(String text, int offset) {
1919
throw new UnsupportedOperationException();
2020
}
2121

22-
@Redirect(
23-
method = "extractWidgetRenderState",
24-
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Font;width(Ljava/lang/String;)I")
25-
)
22+
@Redirect(method = "extractWidgetRenderState", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Font;width(Ljava/lang/String;)I"))
2623
private int codeclient$getFormattedHighlightWidth(Font font, String str) {
2724
return font.width(applyFormat(str, displayPos));
2825
}

0 commit comments

Comments
 (0)