Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-tui/src/layout.rs')
-rw-r--r--helix-tui/src/layout.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/helix-tui/src/layout.rs b/helix-tui/src/layout.rs
index 1f3ddc6e..50a16415 100644
--- a/helix-tui/src/layout.rs
+++ b/helix-tui/src/layout.rs
@@ -83,24 +83,22 @@ impl Layout {
self
}
- pub fn margin(mut self, margin: u16) -> Layout {
+ pub const fn margin(mut self, margin: u16) -> Layout {
self.margin = Margin::all(margin);
self
}
- pub fn horizontal_margin(mut self, horizontal: u16) -> Layout {
- self.margin.left = horizontal;
- self.margin.right = horizontal;
+ pub const fn horizontal_margin(mut self, horizontal: u16) -> Layout {
+ self.margin.horizontal = horizontal;
self
}
- pub fn vertical_margin(mut self, vertical: u16) -> Layout {
- self.margin.top = vertical;
- self.margin.bottom = vertical;
+ pub const fn vertical_margin(mut self, vertical: u16) -> Layout {
+ self.margin.vertical = vertical;
self
}
- pub fn direction(mut self, direction: Direction) -> Layout {
+ pub const fn direction(mut self, direction: Direction) -> Layout {
self.direction = direction;
self
}
@@ -191,7 +189,7 @@ fn split(area: Rect, layout: &Layout) -> Vec<Rect> {
.map(|_| Rect::default())
.collect::<Vec<Rect>>();
- let dest_area = area.inner(&layout.margin);
+ let dest_area = area.inner(layout.margin);
for (i, e) in elements.iter().enumerate() {
vars.insert(e.x, (i, 0));
vars.insert(e.y, (i, 1));