Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
lib: Add spacer border to imUI widgets
Erik Kundt committed 1 year ago
commit 9bceebd1a66cc0cb578908e474e0260a5b1c9012
parent 5e74fdc8b8203ca7a078397b8fe66803cdcb4c65
1 file changed +9 -0
modified src/im.rs
@@ -185,6 +185,7 @@ impl Context {

pub enum Borders {
    None,
+
    Spacer { top: usize, left: usize },
    All,
    Top,
    Sides,
@@ -1236,6 +1237,14 @@ pub mod widget {
        if let Some(border) = borders {
            match border {
                Borders::None => area,
+
                Borders::Spacer { top, left } => {
+
                    let areas = Layout::horizontal([Constraint::Fill(1)])
+
                        .vertical_margin(top as u16)
+
                        .horizontal_margin(left as u16)
+
                        .split(area);
+

+
                    areas[0]
+
                }
                Borders::All => {
                    let block = Block::default()
                        .border_style(style)