From b5b650cfe7df36e83b96c6663f2dc041f5d2b748 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Wed, 14 Apr 2021 17:15:32 +0900 Subject: Fix the last line calculation inside ensure_cursor_in_view --- helix-view/src/view.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'helix-view') 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 -- cgit v1.2.3-70-g09d2