aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/view.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index 25efbde5..265f7df8 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -93,7 +93,10 @@ impl View {
let height = self.area.height.saturating_sub(1); // - 1 for statusline
let last_line = (self.first_line + height as usize).saturating_sub(1);
- let scrolloff = scrolloff.min(self.area.height as usize / 2);
+ // - 1 so we have at least one gap in the middle.
+ // a height of 6 with padding of 3 on each side will keep shifting the view back and forth
+ // as we type
+ let scrolloff = scrolloff.min(height.saturating_sub(1) as usize / 2);
// TODO: not ideal
const OFFSET: usize = 7; // 1 diagnostic + 5 linenr + 1 gutter