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

Label with text overrun behaviour ellipsis inside HBox gets trimmed completely #56915

Closed
stijn-h opened this issue Jan 18, 2022 · 5 comments
Closed

Comments

@stijn-h
Copy link
Contributor

stijn-h commented Jan 18, 2022

Godot version

8958e1b

System information

W10

Issue description

Consider two labels inside an HBoxContainer, both with ellipsis. With just a horizontal size flag of FILL, they are both completely invisible:

fill

. Adding the EXPAND flag does make them show up:

fill_expand

but it always forces both labels to take the same amount of space. This can be a problem when one of the labels is shorter than the other:

fill_expand2

So I can't use EXPAND for my use case. I would like to see FILL work this way:

fill2

Steps to reproduce

Make a scene like this:

HBoxContainer
   Label1
   Label2

Configure both Labels with some text, horizontal size flag FILL, overrun behaviour -> trim_ellipsis

Both labels should now be invisible (see file below).

Minimal reproduction project

test.zip

@stijn-h stijn-h changed the title Label with text overrun behaviour ellipsis inside HBox gets trimmed Label with text overrun behaviour ellipsis inside HBox gets trimmed completely Jan 18, 2022
@fire-forge
Copy link
Contributor

Does using Fill and Expand not work for what you're trying to do?

@stijn-h
Copy link
Contributor Author

stijn-h commented Jan 18, 2022

No, using Expand results in the image above. It cuts off the labels before it, and pushes away labels after it.

@Calinou
Copy link
Member

Calinou commented Jun 1, 2024

@stijn-h Can you still reproduce this on 4.2.2 or later, or is the issue resolved?

@stijn-h
Copy link
Contributor Author

stijn-h commented Jun 2, 2024

@Calinou It doesn't seem like a bug, but more like a 'potentially missing feature' to me. I closed it since I personally no longer need this anymore, and it doesn't seem like anybody else does, either.

@a-johnston
Copy link
Contributor

(Coincidentally ran into this issue a few days after looking at the relevant code, just dumping some info)

The root cause is that there is no way for the label to set/advertise a preferred size to the parent container, only a minimum size, when being laid out by the parent. Since text overrun handling means that there is no technical minimum size, as it can be handled by ellipsis etc, it doesn't bother to compute that and ends up with a minimum width of 1px. Even if the parent container has enough size, it'll still use that 1px minimum size when expand isn't set. Ideally IMO the label would always compute a target size and the parent container would then size it between that and the minimum size (or greater if expand is set) but afaik this is a design limitation with the current UI stuff.

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

No branches or pull requests

5 participants