summaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-04 02:36:28 +0000
committerBlaž Hrastnik2021-06-04 02:36:28 +0000
commitbd4552cd2bcecc2d0591e505c378df9b6cd83cbe (patch)
tree92b291d4746f890cd6101fffc02bf517c3163231 /helix-term/src/commands.rs
parent06d8d3f55fbf02bb4d938ecbc479cd60309a0a5d (diff)
scroll: Fix the clamping
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 3291d359..294c6a0b 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -475,8 +475,8 @@ fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
// clamp into viewport
let line = cursor
.row
- .min(view.first_line + scrolloff)
- .max(last_line.saturating_sub(scrolloff));
+ .max(view.first_line + scrolloff)
+ .min(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