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

Fill remaining width with column #141

Open
9999years opened this issue Apr 5, 2024 · 2 comments
Open

Fill remaining width with column #141

9999years opened this issue Apr 5, 2024 · 2 comments
Labels
f: help wanted Feel free to start working on this t: feature A new feature

Comments

@9999years
Copy link

9999years commented Apr 5, 2024

A detailed description of the feature you would like to see added.

I'd like a column constraint that lets me fill remaining width with a specific column. (Like DynamicFullWidth, but the remaining width is given to a specific column rather than spread out.)

Explain your usecase of the requested feature

I have a table that displays change requests. It includes the title, the change number, the author, updated timestamp, and status information. I'd like the remaining width to be dedicated to the change title.

I want this because subsequent queries will have different widths because the change titles have different lengths. If I could fill the remaining space with the titles, all the tables would have the same width. (Or much more consistent widths.)

@9999years 9999years added the t: feature A new feature label Apr 5, 2024
@Nukesor
Copy link
Owner

Nukesor commented Apr 5, 2024

I see how this can be useful for styling.
It somehow doesn't feel like a constraint to me though and more like a "modifier" or attribute.

All current constraints have strict rules such as "use an exact width", "at least X and/or at most Y", "hide it".

The behavior you're asking for is a "do as usual, but in case something's left put it inside of this column". Additionally, having this as a constraint would prevent usage of any of the other constraints, which doesn't make a lot of sense.

One other thing that needs to be discussed is how should this behave in case multiple columns have this attribute. I assume it should then be split equally upon all those columns?

My proposal on how to implement this, would actually be to add a new property on Column. Something like prioritize_for_leftovers (terrible name, but I couldn't come up with something better from the top of my head). In step 6 of the dynamic arrangement process, the remaining space is then distributed only among those columns, if any exist.

Feel free to start working on this, this is something that would work for comfy-table :)
Please adjust and add proper documentation to all places you touch. Also please write additional tests that extensively test this behavior (one column, multiple columns at different places).

@9999years
Copy link
Author

Additionally, having this as a constraint would prevent usage of any of the other constraints, which doesn't make a lot of sense.

For a particular column? Yeah, that's correct. (I'm imagining a feature similar to TeX's "fill widths".)

Feel free to start working on this, this is something that would work for comfy-table :)

OK, thanks!

@Nukesor Nukesor added the f: help wanted Feel free to start working on this label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: help wanted Feel free to start working on this t: feature A new feature
Projects
None yet
Development

No branches or pull requests

2 participants