aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-22 09:06:52 +0000
committerBlaž Hrastnik2021-03-22 09:06:52 +0000
commitd0530fb83921acc92cd51fd6fa3a8d4846ad5aec (patch)
tree6b697ef5d1d3c3e0a8dcdf728090e39a2aa5f6a0 /helix-term
parent73c92a0bc1499f02092a7425c45d4992f4e573a1 (diff)
Fix a scrolling crash where it would jump past the end of the buffer.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 3f0e32a0..fd95bca4 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -433,7 +433,7 @@ fn scroll(view: &mut View, offset: usize, direction: Direction) {
// clamp into viewport
let line = (view.first_line + cursor_off).clamp(
view.first_line + scrolloff,
- view.first_line + view.last_line().saturating_sub(scrolloff),
+ view.last_line().saturating_sub(scrolloff),
);
let pos = pos_at_coords(text, Position::new(line, cursor.col)); // this func will properly truncate to line end