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

Add get_line_range() to RichTextLabel #11358

Closed
markdibarry opened this issue Dec 15, 2024 · 0 comments · Fixed by godotengine/godot#100432
Closed

Add get_line_range() to RichTextLabel #11358

markdibarry opened this issue Dec 15, 2024 · 0 comments · Fixed by godotengine/godot#100432
Milestone

Comments

@markdibarry
Copy link

Describe the project you are working on

A dialog system.

Describe the problem or limitation you are having in your project

In my system the dialog is paged, so it requires knowledge of the index of the first and last character of each page. Currently, to get the range of a page, line, or otherwise requires looping through the entire string and calling get_character_line() for every char.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

This retrieves the first and last character index for each line, making it much faster and easier task to get the range of a page in my system.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Retrieves the visible character range of the line provided as a Vector2i.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Yes. I can currently do this by looping through the entire string and calling get_character_line() for every character but for longer dialog scripts this can be inefficient.

Is there a reason why this should be core and not an add-on in the asset library?

RTL is core.

@Calinou Calinou changed the title Add get_line_range to RTL Add get_line_range() to RichTextLabel Dec 15, 2024
@akien-mga akien-mga modified the milestones: 4.x, 4.4 Dec 16, 2024
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.

3 participants