mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
remove 1 more per-cell allocation
This commit is contained in:
parent
f7dcc28e1f
commit
93462e7501
2 changed files with 128 additions and 92 deletions
|
|
@ -158,17 +158,22 @@ pub fn phat_cell_3 <T: Content<TuiOut>> (
|
|||
)
|
||||
}
|
||||
pub fn phat_sel_3 <T: Content<TuiOut>> (
|
||||
selected: bool, field_1: T, field_2: T, top: Option<Color>, middle: Color, bottom: Color
|
||||
selected: bool, field_1: T, field_2: T,
|
||||
top: Option<Color>,
|
||||
mid: Color,
|
||||
low: Option<Color>,
|
||||
) -> impl Content<TuiOut> {
|
||||
let border = Style::default().fg(Color::Rgb(255,255,255)).bg(middle);
|
||||
Either::new(selected,
|
||||
Tui::bg(middle, Outer(true, border)
|
||||
.enclose(Align::w(Bsp::s("", Bsp::n("", Fill::y(field_1)))))),
|
||||
Bsp::s(Fixed::y(1, top.map(|top|phat_lo(middle, top))),
|
||||
Bsp::n(Fixed::y(1, phat_hi(middle, bottom)),
|
||||
Fill::xy(Tui::bg(middle, field_2)),
|
||||
)
|
||||
)
|
||||
let border = Style::default().fg(Color::Rgb(255,255,255)).bg(mid);
|
||||
let top = top.map(|top|phat_lo(mid, top));
|
||||
let low = low.map(|low|phat_hi(mid, low));
|
||||
Either::new(
|
||||
selected,
|
||||
Tui::bg(mid, Outer(true, border).enclose(
|
||||
Align::w(Bsp::s("", Bsp::n("", Fill::y(field_1))))
|
||||
)),
|
||||
Bsp::s(Fixed::y(1, top), Bsp::n(Fixed::y(1, low),
|
||||
Fill::xy(Tui::bg(mid, field_2))
|
||||
)),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue