Label sizing
#37084
Replies: 1 comment
-
It seems setting the list item to relative and setting size to full manually was the answer but that was really not obvious (of course I figure this out minutes after posting) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to improve UX on the project symbols view by implementing text ellipsis on RTL text, in order to use it in the project symbols explorer to remove overflow of paths to files. I've already gone and implemented
truncate_start
, which is effectively just truncation + text_direction=RTL, but the core of my issue lies into the fact that while ellipsizing a label does not consider the size of its parent, meaning the ellipsis is always calculated against the overflown length of the label. I think it would make more sense to ellipsize against the visible size, but because labels inherently behave as inline elements, they don't actually have a width - they kind of just flex within their container. That means that ellipsizing against the visible size would waste time running the computation on each frame when we know we only need to do it if the text has overflown.My question thus becomes: Is there a way for an element to know, during rendering, if it will overflow its parent, and if so by how much?
The yellow background is applied to the element of the list item during rendering:
As you can see ellipsizing is completely wrong since it is consider the overflow label size instead of the visible size, making it completely useless. With the GPUI inspector this is even more obvious:
There's probbly something in gpui that I'm missing that could help, but I fail to find it.
Beta Was this translation helpful? Give feedback.
All reactions