-
Notifications
You must be signed in to change notification settings - Fork 31
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
Make container_width
a required alignment parameter
#283
base: main
Are you sure you want to change the base?
Conversation
Some prior discussion here: #278 (comment). > Aligning to the layout's calculated width is not necessarily a sensible default, as that width changes depending on how exactly lines were broken given the container width (max_advance) used for line breaking.
8a2308a
to
4ffeac1
Compare
Added this to the 0.3 milestone, as we probably should resolve this decision before 0.3 to reduce churn. |
layout.align( | ||
layout.width(), | ||
Alignment::Middle, | ||
AlignmentOptions::default(), | ||
); |
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.
If we don't think layout.width()
is a good default then we should probably also change the tests to use 40.0
here.
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.
Ditto the other tests that are line-broken with a specified width.
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.
Yes... you're probably right. I was a bit hesitant due to the snapshot churn it'd cause.
We can also continue the discussion on whether My current thinking is exactly because there's no good no-context default, we should just make One alternative, reusing the |
They will? |
My understanding was that we should be moving to using |
Maybe? I'm not exactly sure yet what it will look like, but one option for line breaking in the presence of floated boxes is to line-break line-by-line, allowing the caller to adjust |
That's a good point actually, requiring a sensible |
I know it doesn't really help us now, but this would be a great use case for rust-lang/rust#132162 |
We don't even need a sensible @nicoburns do you by any chance remember if there were other motivations than the one I mentioned for the separate alignment width? |
I'm not sure it would. Consider the case where the user has text that is not allowed to wrap, and should instead overflow its container if it's too wide. The If my thinking is correct, this probably means with the current methods we can't use |
This could also be represented by a finite
Blitz is currently doing this for alignment width (scroll up for |
Some prior discussion here: #278 (comment).