-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Spaces are counted in RichTextLabel but not Label when using get_total_character_count()
#27896
Comments
maybe renaming both to |
I was taking a look at this, but I haven't worked with the codebase before, so maybe my comment is wrong - so take it with a grain of salt, but: it seems at least the change to This fix was in response to #23720 Maybe it would make more sense to update |
Well, today i found that after some headache hours.... |
I would like to work on this. |
@elizaho It seems nobody is currently working on a fix, so go ahead 🙂 |
What are the steps to reproduce this error? |
@elizaho Create a rich text label and label with the same text above and use |
|
If you've set the text immediately before calling Use |
Spaces in Label and RichTextLabel godotengine#27896
get_total_character_count()
Just ran into this problem, would definitely love to have at least an alternate option to include space on Label/exclude space on RichTextLabel |
In 4.0 version this function "get_total_character_count()" return equal values for both Label and RichTextLabel, but it counts spaces and the documentation says it doesn't. Can I try to fix the function or is it better to just change the documentation? |
See #37969 which modifies Label's character counting to include spaces. Either way, I think this should be discussed in a proposal since this would change either functions' behaviors (and is therefore a compatibility-breaking change). My suggestions would be:
|
Ah, sorry for the ignorance, I thought that this PR #37969 was not merged yet, so the function hasn't changed... Anyway, I'll try to do what you have said. Thanks a lot! |
Godot version:
3.1
There are differences in how richtextlabel and label hadle spaces in their texts. richtextlabel counts spaces when using get_total_character_count() while label does not:
This isn't that much of a problem because you can just use text.length() BUT when you use label.visible_characters += 1, that becomes a problem. For examle I wrote a system that shows the same text for both of those nodes and it works only with one of them at a time because each node handles spaces differently.
This is very annoying and messy. It would be great if both of them counted spaces.
The text was updated successfully, but these errors were encountered: