aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-01 05:23:10 +0000
committerBlaž Hrastnik2021-03-01 05:23:10 +0000
commit00808afe3c215d159574b23e30326379428060bf (patch)
treeb9f4fdb9cf559e95340a625c7741e9dbcd31b41b /helix-view/src
parent2c9b02039bac81cb32309bd0d4e2b08191356b9c (diff)
ui: Make editor more resilient about being shrunk too small.
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/view.rs2
1 files changed, 1 insertions, 1 deletions
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,