restruct: 14e

This commit is contained in:
i do not exist 2026-06-25 21:49:33 +03:00
parent 47ef33180c
commit 804a5bc905

View file

@ -88,10 +88,14 @@ impl App {
pub fn new_shared_run (
exit: &Exit, jack: &Jack<'static>, project: Arrangement, config: Config, mode: impl AsRef<str>
) -> Usually<(Self, Task, Task)> {
) -> Usually<(Arc<RwLock<Self>>, Task, Task)> {
let state = Self::new_shared(&jack, project, config, mode);
let keyboard = tui_input(&exit, &state, Duration::from_millis(100))?;
let terminal = tui_output(&exit, &state, Duration::from_millis(10))?;
let keyboard = tui_input(
exit.as_ref(), &state, Duration::from_millis(100)
)?;
let terminal = tui_output(
&mut std::io::stdout(), exit.as_ref(), &state, Duration::from_millis(10)
)?;
Ok((state, keyboard, terminal))
}
@ -497,7 +501,7 @@ fn app_interpret_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usua
let height = (modes.read().unwrap().len() * 2) as u16;
h_exact(height, w_min(Some(30), thunk(move |to: &mut Tui|{
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 b = 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>");
let info = profile.info.get(0).map(|x|x.as_ref()).unwrap_or("<no info>");
let fg1 = Rgb(224, 192, 128);
@ -506,20 +510,23 @@ fn app_interpret_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usua
let field_id = w_full(origin_e(fg(fg2, id)));
let field_info = w_full(origin_w(info));
y_push((2 * index) as u16,
h_exact(2, w_full(bg(bg, south(
above(field_name, field_id), field_info))))).draw(to);
h_exact(2, w_full(bg(b, south(
above(field_name, field_id),
field_info
))))).draw(to);
}
Ok(to.area().into())
})))
}.draw(to),
Some(":sessions") => h_exact(Some(6), w_min(Some(30), thunk(|to: &mut Tui|{
let fg = Rgb(224, 192, 128);
let f = 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) };
let b = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) };
y_push((2 * index) as u16,
&h_exact(2, w_full(bg(bg, origin_w(fg(fg, name)))))).draw(to);
&h_exact(2, w_full(bg(b, origin_w(fg(f, name)))))).draw(to);
}
Ok(())
Ok(to.area().into())
}))).draw(to),
Some(":browse/title") => w_full(origin_w(field_v(ItemColor::default(),
@ -557,7 +564,7 @@ fn app_interpret_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usua
},
_ => unreachable!()
}
};
Ok(())
}