wip: layout

This commit is contained in:
🪞👃🪞 2024-06-12 23:21:56 +03:00
parent ac865824cc
commit d627d257ad
13 changed files with 220 additions and 131 deletions

View file

@ -53,6 +53,21 @@ pub fn draw_box (buffer: &mut Buffer, area: Rect) {
buffer.set_string(area.x, area.y + area.height - 1, bottom, border);
}
pub fn draw_box_styled (buffer: &mut Buffer, area: Rect, style: Option<Style>) {
if area.width < 1 || area.height < 1 {
return
}
let style = style.unwrap_or(Style::default());
let top = format!("{}", "".repeat((area.width - 2).into()));
let bottom = format!("{}", "".repeat((area.width - 2).into()));
buffer.set_string(area.x, area.y, top, style);
for y in (area.y + 1)..(area.y + area.height - 1) {
buffer.set_string(area.x, y, format!(""), style);
buffer.set_string(area.x + area.width - 1, y, format!(""), style);
}
buffer.set_string(area.x, area.y + area.height - 1, bottom, style);
}
pub fn draw_focus_corners (buffer: &mut Buffer, area: Rect) {
let focus = Style::default().yellow().bold().not_dim();
buffer.set_string(area.x, area.y, "", focus);