aboutsummaryrefslogtreecommitdiff
path: root/helix-tui/src
diff options
context:
space:
mode:
authorGokul Soumya2022-06-21 16:52:08 +0000
committerGitHub2022-06-21 16:52:08 +0000
commit8e8367eea6ff146c7e1097af153398832691e078 (patch)
tree02e137d840c02eb99b926c3bb6f8349902b0946a /helix-tui/src
parentce85b9716df5e1ea804994202687f19cd711ae1b (diff)
Refactor Margin for fine grained control (#2727)
Diffstat (limited to 'helix-tui/src')
-rw-r--r--helix-tui/src/layout.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/helix-tui/src/layout.rs b/helix-tui/src/layout.rs
index e6a84aa0..7c72a778 100644
--- a/helix-tui/src/layout.rs
+++ b/helix-tui/src/layout.rs
@@ -68,10 +68,7 @@ impl Default for Layout {
fn default() -> Layout {
Layout {
direction: Direction::Vertical,
- margin: Margin {
- horizontal: 0,
- vertical: 0,
- },
+ margin: Margin::none(),
constraints: Vec::new(),
}
}
@@ -87,20 +84,19 @@ impl Layout {
}
pub fn margin(mut self, margin: u16) -> Layout {
- self.margin = Margin {
- horizontal: margin,
- vertical: margin,
- };
+ self.margin = Margin::all(margin);
self
}
pub fn horizontal_margin(mut self, horizontal: u16) -> Layout {
- self.margin.horizontal = horizontal;
+ self.margin.left = horizontal;
+ self.margin.right = horizontal;
self
}
pub fn vertical_margin(mut self, vertical: u16) -> Layout {
- self.margin.vertical = vertical;
+ self.margin.top = vertical;
+ self.margin.bottom = vertical;
self
}