Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichTextLabel: changes to 'text' have no effect to text entered with append_text() #93812

Closed
andrea-calligaris opened this issue Jul 1, 2024 · 4 comments

Comments

@andrea-calligaris
Copy link
Contributor

Tested versions

Godot Engine v4.2.2.stable.official

System information

Xubuntu 22.04.4 LTS

Issue description

Changes to RichTextLabel's text property have no effect to text previously entered with append_text()

Due to the particular way that RichTextLabel works, with the stack and everything, it's important to highlight that this behavior is NOT consistent with the documentation, see:

Description
Any edits made to text will erase previous edits made from other manual sources such as append_text()

Workaround

The workaround is to use clear(), despite the documentation explicitly says that just setting text should be enough:

void clear()
Clears the tag stack.
Note: This method will not modify text, but setting text to an empty string also clears the stack.

Steps to reproduce

Example project provided.
Alternatively:

Steps

  • Change the RichTextLabel with append_text()
  • Later, through a button, attempt to clear the label with $RichTextLabel.text = ""
  • Add some more text with append_text()
  • The new text is going to be appended to the previously added text that was supposed to have been cleared.

Minimal reproduction project (MRP)

RichTextLabelBug.zip

@andrea-calligaris
Copy link
Contributor Author

Possibly related to:
#61260
#18413
#12882

@AThousandShips
Copy link
Member

Sounds like a duplicate of:

Which has already been fixed but wasn't cherry picked for 4.2

@andrea-calligaris
Copy link
Contributor Author

andrea-calligaris commented Jul 3, 2024

Yes, thanks, it's the same issue but the bug is still present in 4.2.2.

@AThousandShips
Copy link
Member

This error being present in 4.2.2 but not latest means this is resolved, sorry that I didn't notice you reopened this

Please wait for a future 4.2.x version and that issue to be cherry picked, as it has been resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants