refactor: down to 50 errors

considering whether to implement layout methods on Area
This commit is contained in:
🪞👃🪞 2024-09-07 13:20:56 +03:00
parent 06f8bd1116
commit 7bcd40b425
7 changed files with 77 additions and 86 deletions

View file

@ -34,13 +34,8 @@ impl ArrangerRenameModal {
impl Render<Tui> for ArrangerRenameModal {
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
let area = to.area();
let y = area.y + area.height / 2;
let bg_area = Rect {
x: 1,
y: y - 1,
width: area.width - 2,
height: 3
};
let y = area.y() + area.h() / 2;
let bg_area = [1, y - 1, area.w() - 2, 3];
to.fill_bg(bg_area, Nord::BG0);
Lozenge(Style::default().bold().white().dim()).draw(to.with_rect(bg_area));
let label = match self.target {
@ -50,11 +45,11 @@ impl Render<Tui> for ArrangerRenameModal {
ArrangerFocus::Clip(_, _) => "Rename clip:",
};
let style = Some(Style::default().not_bold().white().not_dim());
to.blit(&label, area.x + 3, y, style)?;
to.blit(&label, area.x() + 3, y, style)?;
let style = Some(Style::default().bold().white().not_dim());
to.blit(&self.value, area.x + 3 + label.len() as u16 + 1, y, style)?;
to.blit(&self.value, area.x() + 3 + label.len() as u16 + 1, y, style)?;
let style = Some(Style::default().bold().white().not_dim().reversed());
to.blit(&"", area.x + 3 + label.len() as u16 + 1 + self.cursor as u16, y, style)?;
to.blit(&"", area.x() + 3 + label.len() as u16 + 1 + self.cursor as u16, y, style)?;
Ok(Some(area))
}
}