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 doesn't count wrapped lines properly #40982

Closed
KoBeWi opened this issue Aug 2, 2020 · 5 comments · Fixed by #45128
Closed

RichTextLabel doesn't count wrapped lines properly #40982

KoBeWi opened this issue Aug 2, 2020 · 5 comments · Fixed by #45128
Assignees
Milestone

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Aug 2, 2020

Godot version:

3.2.3 rc3

Issue description:

This code

func _process(delta: float) -> void:
	if $RichTextLabel.visible_characters < $RichTextLabel.text.length():
		$RichTextLabel.visible_characters += 4
	
	print("Lines visible: ", $RichTextLabel.get_visible_line_count())

will always print 1 for a long text with multiple wrapped lines. It used to show the number of lines correctly.

This is a regression from #40217
CC @theoway

(adding 3.2 milestone because it's a cherry-picked regression, but the issue exists on master too)

Minimal reproduction project:
ReproductionProject.zip

@KoBeWi KoBeWi added this to the 3.2 milestone Aug 2, 2020
@theoway
Copy link
Contributor

theoway commented Aug 3, 2020

I'll look into it.

@theoway
Copy link
Contributor

theoway commented Aug 3, 2020

I'll look into it.

Actually it doesn't count wrapped lines at all. It only counts lines and newlines that are drawn and are visible. As for before the fix, it wouldn't always give the correct number of wrapped visible lines.

@akien-mga
Copy link
Member

I reverted the cherry-pick in 3.2 for now until we figure out the regression, so putting on the 4.0 milestone (where the regression is still present).

@akien-mga
Copy link
Member

Seems reproducible in the current master branch (so it was not fixed by @bruvzg's RichTextLabel refactoring).

@bruvzg bruvzg self-assigned this Jan 6, 2021
@bruvzg
Copy link
Member

bruvzg commented Jan 12, 2021

For the reference get_line_count and scroll_to_line functions do not count wrapped lines as well, so get_visible_line_count is consistent with other functions.

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