Reproduction Steps
Any TextLabel with RichText enabled will render an invisible space character after each \n (presumably \r just based on previous related bugs).
This is hugely detrimental because it means that text on new lines no longer align correctly as all their line breaks are now indented by this invisible character but the first line and all dynamic line wraps are not.
Disabling RichText shows that this whitespace character is not actually in my .Text, but simply a bug with how RichText handles it.
Worth noting that this bug occurs regardless of whether you’re utilizing rich tags- enabling RichText on simple content will still get messed up by this.
Repro:
Enable .RichText on a TextObject with \n characters in the text. More visible when TextXAlignment is set to Left. RichTextIndent_Repro.rbxl (36.5 KB)
Expected Behavior
I expect \n to create a line break with no additional indent (like it does when RichText is disabled) so that it accurately represents the text string it is meant to be rendering.
Actual Behavior
See above. I included an image of the issue and a repro .rbxl for your convenience.
Workaround
No full workaround, but prefixing the text with “\r” at least makes the first line align with the indent, even if all the wrapped lines still misalign.
Issue Area: Engine Issue Type: Display Impact: High Frequency: Constantly
It looks like a fix in February was pending from Version 512 that was never enabled.
Seems like this bug may have been forgotten, could you follow up and enable the fix?
Hi, I tried to turn on that fix but it triggered some crashes. We are working on a refactor of the pipeline and it would fix the issue in a more proper way. While I can bump this and take a look.
I’ve honestly decided against using RichText with TextWrapped until a few bugs are fixed. However, I appreciate the transparency and look forward to an enriched text experience.
There is a small workaround, when using RichText try to wrap newlines in <font size="0"> !
While it “fixes” the issue, I’m not sure if it’s too reliable, although useful regardless.