The bug
Number of characters before line cutoff in chat is not same when unicode mode is enabled and when it is off.
How to reproduce
Enable unicode
Run the following command (to put the maximum length of text on screen):
/tellraw @p {"text":"12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345 12345"}
Disable unicode
Run the command again (to ensure that the two messages have the same number of characters)
→ Notice that the cutoffs are not the same in the identical messages
I think that the best way to fix this problem is to increase length of text-line when unicode-mode is disabled.
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 1
Attachments
Comments 10
Thank you for editing. However, you have changed the essence of my treatment.
It is necessary that the length of the displayed text in both modes was the same, and is not recalculated when changing modes.
Edit: looked at the picture.
I disagree with the suggested fix, the correct fix would be to recalculate chat widths from a cache when unicode is enabled or disabled.
The problem is that the original chat is edited and line breaks added when messages are recieved.
But this is a really minor issue, restarting the client should fix this as it only happens when unicode mode is changed, not if unicode is just on, or just off all game session.
This also happens when switching resource packs that have custom fonts.
Based on Minecraft 1.10.2 code decompiled via MCP 9.30
In net.minecraft.client.gui.GuiNewChat.setChatLine(ITextComponent, int, int, boolean)
, the game already calculates the text wrapping by creating separate net.minecraft.client.gui.ChatLine
objects for each line of the wrapped text. This is problematic because if the font is changed, the game can't tell whether two ChatLines
are part of the same wrapped "line", and it cannot and will not rewrap the text.
To fix this bug, the game should store the whole message as one ChatLine
, and the text wrapping should be computed during rendering.
@unknown, please link from the description to your comment.
It might be more efficient to store the base text and the chat lines. Then it does not have to calculate where to split the text all the time.
It is very annoying, because I can not normally create entertainment, please correct this misunderstanding!