From 00808afe3c215d159574b23e30326379428060bf Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Mon, 1 Mar 2021 14:23:10 +0900 Subject: ui: Make editor more resilient about being shrunk too small. --- helix-view/src/view.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'helix-view') diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs index f3d92bfd..1d806da9 100644 --- a/helix-view/src/view.rs +++ b/helix-view/src/view.rs @@ -65,7 +65,7 @@ impl View { /// Calculates the last visible line on screen #[inline] pub fn last_line(&self) -> usize { - let viewport = Rect::new(6, 0, self.area.width, self.area.height - 1); // - 1 for statusline + let viewport = Rect::new(6, 0, self.area.width, self.area.height.saturating_sub(1)); // - 1 for statusline std::cmp::min( self.first_line + (viewport.height as usize), self.doc.text().len_lines() - 1, -- cgit v1.2.3-70-g09d2