pub struct Share(/* private fields */);Expand description
How much of the width an arrangement’s first region takes.
e0fd485e. Nothing said how much room a region got, so every renderer
invented its own number and two hosts showing one screen disagreed about
its proportions. A webview never noticed, because the stylesheet answered
once for every consumer; a terminal has no stylesheet to inherit from, so
quasi-tui picked 24 columns for a sidebar and 40% for a list pane and
neither had anything behind it.
§A proportion, never a unit
Held as a percentage, and that is the only form it comes in. A description carrying columns would be describing a terminal and one carrying pixels a webview, and the whole point is that both honour the same fact: a terminal resolves it against a column count, a webview writes it into a grid, and neither has to know what the other did.
It is not makeover_geometry::Ratio’s job either, which was the first
guess. Geometry is scales that answer the same for every screen and takes
no input that would let a sidebar screen differ from a list-detail one.
Implementations§
Sourcepub const SIDEBAR: Self
pub const SIDEBAR: Self
What a sidebar takes, when nobody says otherwise.
A quarter. quasi-tui drew 24 columns, which is a quarter of a
96-column terminal and about a fifth of a wide one; a quarter is that
number said in the form a webview can honour too.
Sourcepub const LIST: Self
pub const LIST: Self
What the list side of a list-detail takes, when nobody says otherwise.
quasi-tui’s 40%, which was already a proportion and is the one number
this member did not have to invent.
Sourcepub const fn percent(percent: u8) -> Self
pub const fn percent(percent: u8) -> Self
A share of the width, as a percentage.
Clamped to 5..=95 rather than refused. A description that asked for a region of nothing is a bug in the app, and a renderer drawing a region zero cells wide reports it as a region that vanished, which is the hardest kind of bug to find from what is on the screen.
Sourcepub const fn as_percent(self) -> u8
pub const fn as_percent(self) -> u8
The share as a percentage.
Sourcepub const fn of(self, whole: u16) -> u16
pub const fn of(self, whole: u16) -> u16
This share of a width, rounded to the nearest whole unit.
What a terminal calls to turn the proportion into columns. At least one, because a region the description named should be visible: a screen 3 columns wide is unusable either way, and a sidebar that is there is a truer picture of the description than a sidebar that is not.