-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Fix get_visible_line_count
in RichTextLabel
#101205
Fix get_visible_line_count
in RichTextLabel
#101205
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks OK, but will also change behavior on completely empty lines (which were counted before), and I'm not sure if it's desired.
You mean they are no longer counted?
correctly returns 3 lines.
incorrectly (?) returns 3 lines. Looks like if the text ends with empty line, it will be ignored. All other empty lines are properly counted. |
All other lines except last probably aren't fully empty (contain line break character). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old code was not counting the last empty line either, so this should not be a concern (at least not in this PR context).
3708870
to
3e333df
Compare
get_visible_line_count
in RichTextLabel
Thanks! |
Fixes #75847
The
_draw_line()
function in RichTextLabel was adding toline_count
, no matter how many lines were actually visible. This made the functionget_visible_line_count()
to return an incorrect amount. Forvisible_characters = 0
it would return 0, but setting it any higher would return a line count for all lines, even ones which weren't visible.I hope this is enough to fix and close #75847