Using Constraint::Min
in in Table::widths
results in constantly changing column layout.
#499
Comments
The root cause of this is likely #420. I confirmed this also happens with How do I satisfy the solver and provide more precise constraints? Nested tables? It would be much more convenient to be able to combine these and I don't see how it is imprecise to have one column using |
You can't nest
I don't think this is as simple as implementing the Two tables is still possible, but now they need their own |
I agree that this is a bug in the constraint solver; your table specification isn't underconstrainted. As a workaround, have you tried switching one or more columns to |
Yes, I switched everything to use I wrote some hot garbage to try to gracefully expand to fit larger windows: https://github.com/medwards/gitt/blob/column_width_calculator/src/main.rs#L88 (for context, this is supposed to be a tui Basically I tried to write my own layout solver, found it to be super buggy, and gave up. |
This is a somewhat a known limitation of the current architecture of the crate. Under the hood, Good news: because of an other issue I migrated My recommendation in any case would be to use more precise layout constraints ( |
I think this is fine.
"Precise" is relative here. Percents work fine on big screens, but as the screen size gets smaller you need to make trade-offs, and some column widths are more disposable than others.
The I notice a few other options here too, like |
The layout caching for tables is working fine, so going to close this bug as that was the original issue. There's of course the broader issue of the |
That was not my intention. My point was more that we are probably not using it the way it was intended for. You made a good point about giving users more control over their constraints. I played a bit with the idea in #519. Let me know what you think if you have time :). |
Description
I added the following constraints to a new table. These aren't the final values I want, so they're just preliminary to see what it looks like:
I end up seeing this:
To Reproduce
The latest commit /w this problem in my application is at https://github.com/medwards/gitt/tree/buggy_table_constraints
You can also change
examples/table.rs
with the following patch:And then:
Expected behavior
Minimally, I expected the column widths to remain the same if the rows and no other state change. In this case I expect there to be 30 characters spent for the right-most columns and whatever is left is used by the left-most column (ie
Constraint::Min(n)
means it should be at least n wide but will also use any remaining width available).This might just be a docs snag, maybe
Min
means something else, butConstraint
has no docs to explain otherwise.Environment
gnome-terminal
crossterm
The text was updated successfully, but these errors were encountered: