aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-04-14 08:15:32 +0000
committerBlaž Hrastnik2021-04-14 08:15:32 +0000
commitb5b650cfe7df36e83b96c6663f2dc041f5d2b748 (patch)
treeed9956aa5ef1fc7edb39d411707ee94c4bb23f7b
parentc64240b6ef20928424f76ee320f0b2d3a69b1132 (diff)
Fix the last line calculation inside ensure_cursor_in_view
-rw-r--r--helix-view/src/view.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index 1bf7c370..5519d9ff 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -81,7 +81,8 @@ impl View {
let pos = coords_at_pos(doc.text().slice(..), cursor);
let line = pos.row;
let col = pos.col;
- let last_line = self.last_line(doc);
+ let height = self.area.height.saturating_sub(1); // - 1 for statusline
+ let last_line = self.first_line + height as usize;
let scrolloff = PADDING.min(self.area.height as usize / 2); // TODO: user pref