Patcher icon indicating copy to clipboard operation
Patcher copied to clipboard

Fix compact chat scrolling

Open Alexdoru opened this issue 1 year ago • 0 comments

When removing ChatLines from the drawChatLines of GuiNewWhat, if you have your chat opened and scrolled up somewhere, your whole chat will move.

This part of the code needs to be changed : https://github.com/Sk1erLLC/Patcher/blob/4ce6e196e5ad1339f8a0ab96eb5680c2f6464583/src/main/java/club/sk1er/patcher/util/chat/ChatHandler.java#L231

Current :

chatLinesWrapped.remove(index);
index--;

Fixed :

chatLinesWrapped.remove(index);
index--;
if (mc.ingameGUI.getChatGUI().getChatOpen()) {
    mc.ingameGUI.getChatGUI().scroll(-1);
}

In the method GuiNewChat.setLine, you can see that the vanilla code is doing the opposite operation to avoid the same problem when adding chat lines.

if (this.getChatOpen() && this.scrollPos > 0)
{
    this.isScrolled = true;
    this.scroll(1);
}

Alexdoru avatar Jul 18 '24 03:07 Alexdoru