diff options
author | Gokul Soumya | 2021-08-21 05:21:20 +0000 |
---|---|---|
committer | GitHub | 2021-08-21 05:21:20 +0000 |
commit | f9375f449c8b7bbf792c88b89903fe38d524f2e5 (patch) | |
tree | 71a2313a7a7cebc071dffd9e3423f407eb4192e0 /helix-view/src/view.rs | |
parent | ac8bc541087f815a026b4c664c069d8806b9c5de (diff) |
Refactor new Rect construction (#575)
* Refactor new Rect construction
Introduces methods that can be chained to construct new Rects
out of pre-existing ones
* Clamp x and y to edges in Rect chop methods
* Rename Rect clipping functions
Diffstat (limited to 'helix-view/src/view.rs')
-rw-r--r-- | helix-view/src/view.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs index b707c092..01f18c71 100644 --- a/helix-view/src/view.rs +++ b/helix-view/src/view.rs @@ -83,12 +83,7 @@ impl View { pub fn inner_area(&self) -> Rect { // TODO: not ideal const OFFSET: u16 = 7; // 1 diagnostic + 5 linenr + 1 gutter - Rect::new( - self.area.x + OFFSET, - self.area.y, - self.area.width - OFFSET, - self.area.height.saturating_sub(1), // -1 for statusline - ) + self.area.clip_left(OFFSET).clip_bottom(1) // -1 for statusline } pub fn ensure_cursor_in_view(&mut self, doc: &Document, scrolloff: usize) { |