summaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-02 04:19:21 +0000
committerBlaž Hrastnik2021-06-02 04:20:36 +0000
commitcbb3ebafdc6f2473264ad7cde99ddfff5a80a832 (patch)
treee64ec88a34cefcca59635204c4340afdc950d9e2 /helix-term/src/commands.rs
parent0851110d10d19f34deb7945d19576e20d7a9d29b (diff)
Support ctrl-f and ctrl-b to page up/down, fixes #41
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 6465241f..7b30168a 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -473,10 +473,10 @@ fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
let last_line = view.last_line(doc);
// clamp into viewport
- let line = cursor.row.clamp(
- view.first_line + scrolloff,
- last_line.saturating_sub(scrolloff),
- );
+ let line = cursor
+ .row
+ .min(view.first_line + scrolloff)
+ .max(last_line.saturating_sub(scrolloff));
let text = doc.text().slice(..);
let pos = pos_at_coords(text, Position::new(line, cursor.col)); // this func will properly truncate to line end