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 tag stack overwritten by bbcode_text manipulation. #12881

Closed
Tracked by #39144
willnationsdev opened this issue Nov 13, 2017 · 3 comments · Fixed by #56807
Closed
Tracked by #39144

RichTextLabel tag stack overwritten by bbcode_text manipulation. #12881

willnationsdev opened this issue Nov 13, 2017 · 3 comments · Fixed by #56807

Comments

@willnationsdev
Copy link
Contributor

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Windows 10
Godot 3.0 master

Issue description:
If you use append_bbcode(...), any push_* function, or the pop function to manipulate the internal tag stack of RichTextLabel, all of those changes are currently being cleared whenever someone directly edits the bbcode_text property

Steps to reproduce:
Create project with RichTextLabel root node. Add a script to it:

# RichTextLabel.gd
func _ready():
    push_image(load("res://icon.png")
    # bbcode_text += "hi"

Run the scene with and without the second line commented and you'll find that the image is missing (removed) when you manipulate bbcode_text.

@theoway
Copy link
Contributor

theoway commented Jun 22, 2020

From the documentation:
It is unadvised to use += operator with bbcode_text (e.g. bbcode_text += "some string") as it replaces the whole text and can cause slowdowns. Use append_bbcode for adding text instead.

@willnationsdev
Copy link
Contributor Author

@theoway Is that an intended design choice though? Or would it make sense for the += operator to execute the same logic as append_bbcode?

@theoway
Copy link
Contributor

theoway commented Jun 24, 2020

@theoway Is that an intended design choice though? Or would it make sense for the += operator to execute the same logic as append_bbcode?

It does make sense for the += operator to work as append_bbcode() but the current design doesn't allow that. I don't think there's a use case for that as there's already append_bbcode().

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

Successfully merging a pull request may close this issue.

4 participants