mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 13:46:42 +01:00
wip: layout
This commit is contained in:
parent
ac865824cc
commit
d627d257ad
13 changed files with 220 additions and 131 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue