[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vtable: Add column weights feature
From: |
Tad Fisher |
Subject: |
Re: vtable: Add column weights feature |
Date: |
Sat, 8 Oct 2022 14:11:13 -0700 |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Tad Fisher <tadfisher@gmail.com> writes:
>
>> This is a patch to allow allocating the full window width to vtable
>> columns, in proportion to a new `weight' slot value.
>
> Thanks, the code looks good.
>
> But I'm not quite sure how the "weight" concept interacts with
> percentage widths? That is, when would it be preferable to add width
> specs to columns instead of just using percentages? (And an explanation
> for this should be added to the manual.)
In my mind, "percentage of window width" specs aren't useful to begin
with, because they interact poorly with fixed-width columns. If your
goal is to have the vtable occupy a particular width of the window (e.g.
100%), this goal becomes difficult/impossible as soon as a fixed-width
column is added.
So in the case you want the vtable to occupy 100% of the window width,
weights are the strictly superior option. In case you want the vtable to
occupy, say, 80% of the window width, then the only option is to assign
percentages to all columns and strictly avoid fixed-width specs.
Ideally, you'd have a constraint on the vtable itself---as in, "I want
the vtable to occupy 80% of the window width", and that value is used
instead of (window-width nil t) when calculating column widths.
And I do think that defining these concepts as "constraints" is the
better approach in the long run; as in, the "width", "min-width", and
"max-width" slots become part of an enumerated "constraint" type,
so the API limits the possible values to those that make sense. Then
the vtable--column-widths function solves those constraints to obtain
the final width values. Does this make sense? My experience is mostly
from Android UIs where this is a common way to define layouts, and my
understanding is that the CSS "flexbox" model is similar.