From 804a5bc905774de75ea99598905afc4b9a4723e7 Mon Sep 17 00:00:00 2001 From: i do not exist Date: Thu, 25 Jun 2026 21:49:33 +0300 Subject: [PATCH] restruct: 14e --- src/app.rs | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/app.rs b/src/app.rs index 1bf483e7..2c88280a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -88,10 +88,14 @@ impl App { pub fn new_shared_run ( exit: &Exit, jack: &Jack<'static>, project: Arrangement, config: Config, mode: impl AsRef - ) -> Usually<(Self, Task, Task)> { + ) -> Usually<(Arc>, 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(""); let info = profile.info.get(0).map(|x|x.as_ref()).unwrap_or(""); 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(()) }