update layout macro invocations

This commit is contained in:
🪞👃🪞 2024-12-31 04:37:45 +01:00
parent e677d1d7d4
commit 83eb9dd2fa
19 changed files with 153 additions and 169 deletions

View file

@ -150,11 +150,8 @@ impl Plugin {
})
}
}
impl Render<Tui> for Plugin {
fn min_size (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
Ok(Some(to))
}
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
impl Content<Tui> for Plugin {
fn render (&self, to: &mut TuiOutput) {
let area = to.area();
let [x, y, _, height] = area;
let mut width = 20u16;
@ -186,12 +183,11 @@ impl Render<Tui> for Plugin {
},
_ => {}
};
draw_header(self, to, x, y, width)?;
Ok(())
draw_header(self, to, x, y, width);
}
}
fn draw_header (state: &Plugin, to: &mut TuiOutput, x: u16, y: u16, w: u16) -> Usually<()> {
fn draw_header (state: &Plugin, to: &mut TuiOutput, x: u16, y: u16, w: u16) {
let style = Style::default().gray();
let label1 = format!(" {}", state.name);
to.blit(&label1, x + 1, y, Some(style.white().bold()));
@ -199,7 +195,6 @@ fn draw_header (state: &Plugin, to: &mut TuiOutput, x: u16, y: u16, w: u16) -> U
let label2 = format!("{}", &path[..((w as usize - 10).min(path.len()))]);
to.blit(&label2, x + 2 + label1.len() as u16, y, Some(style.not_dim()));
}
Ok(())
//Ok(Rect { x, y, width: w, height: 1 })
}