flatten keybinds, stack component broken
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-09-01 21:27:30 +03:00
parent e987aa697d
commit 34070de5f7
3 changed files with 169 additions and 161 deletions

View file

@ -1,8 +1,12 @@
use crate::*;
content!(TuiOut:|self: App|Fill::xy(Stack::above(|add|{
for dsl in self.mode.view.iter() { add(&Fill::xy(self.view(dsl.as_ref()))); }
})));
impl Content<TuiOut> for App {
fn content (&self) -> impl Render<TuiOut> + '_ {
Stack::above(move|add|for dsl in self.mode.view.iter() {
add(&Fill::xy(self.view(dsl.as_ref())));
})
}
}
impl App {
fn view <'t, D: Dsl> (&'t self, index: D) -> TuiBox<'t> {
@ -123,7 +127,7 @@ impl<'t> DslNs<'t, TuiBox<'t>> for App {
":templates" => Box::new({
let modes = app.config.modes.clone();
let height = (modes.read().unwrap().len() * 2) as u16;
Fixed::y(height, Min::x(30, Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
Fixed::y(height, Min::x(30, Stack::south(move|add|{
for (index, (id, profile)) in modes.read().unwrap().iter().enumerate() {
let bg = if index == 0 { Rgb(70,70,70) } else { Rgb(50,50,50) };
let name = profile.name.get(0).map(|x|x.as_ref()).unwrap_or("<no name>");
@ -138,15 +142,13 @@ impl<'t> DslNs<'t, TuiBox<'t>> for App {
}
})))
}),
":sessions" => Box::new(Fixed::y(6, Min::x(30, Stack::south(
move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
let fg = Rgb(224, 192, 128);
for (index, name) in ["session1", "session2", "session3"].iter().enumerate() {
let bg = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) };
add(&Fixed::y(2, Fill::x(Tui::bg(bg, Align::w(Tui::fg(fg, name))))));
}
":sessions" => Box::new(Fixed::y(6, Min::x(30, Stack::south(move|add|{
let fg = Rgb(224, 192, 128);
for (index, name) in ["session1", "session2", "session3"].iter().enumerate() {
let bg = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) };
add(&Fixed::y(2, Fill::x(Tui::bg(bg, Align::w(Tui::fg(fg, name))))));
}
)))),
})))),
":browse/title" => Box::new(Fill::x(Align::w(FieldV(Default::default(),
match app.dialog.browser_target().unwrap() {
BrowseTarget::SaveProject => "Save project:",