Closed JustAlittleWolf closed 9 months ago
this all sounds good, but do you have any examples of what chat would look like before and after this fix? i just don't entirely understand what this is fixing. thanks!
Hi! My previous speedup had a problem where it would not correctly remove messages like this:
In this case the values would be:
calcVisibles.get(0) ->
"multiple lines"
StringTextUtils.reorder(visibleMessages.get(0).content(), false)) ->
"<JustAlittleWolf> This is a very"
So the check would obviously fail:
calcVisibles.get(0).equalsIgnoreCase(StringTextUtils.reorder(visibleMessages.get(0).content(), false))) ->
false
This is not an issue when CompactChat mode is enabled, as all lines are checked there.
The fix addresses this by simply always deleting the last message. Further up in the code you check for equality already anyways, so it can be assumed that the previous message is equal to the next message, as seen here in line 80.
With the fix it now correctly deletes the last message and looks like this:
thank you so much for the detailed explanation! this just makes it much easier for the future if any other issues come up. i really appreciate it!! 😁
So I noticed there was this issue when sometimes messages would be detected as duplicate (it would show the duplicate counter in the chat) but the old message wasn't deleted. This can occur when a message is multiline in the chat, in which case the equalsignorecase does not work properly. This did not affect the previous method of checking all visiblemessages against all calculated messages but does affect only checking the first element. The fix is to always delete the first displayed message, because further up in the file there was already a check if the new and previous messages are equal. The while loop is necessary to correctly delete multiline messages.