on master help sign in
scroll: Fix the clamping
commitbd4552cd2bcecc2d0591e505c378df9b6cd83cbe authorBlaž Hrastnik <blaz@mxxn.io> dateFri 4 Jun 2021, 11:36 (5 years ago) parent06d8d3f
1 file changed+2−2
helix-term/src/commands.rs+2−2
helix-term/src/commands.rs+2−2
@@ -475,8 +475,8 @@ fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
475475 // clamp into viewport
476476 let line = cursor
477477 .row
478− .min(view.first_line + scrolloff)
479− .max(last_line.saturating_sub(scrolloff));
478+ .max(view.first_line + scrolloff)
479+ .min(last_line.saturating_sub(scrolloff));
480480
481481 let text = doc.text().slice(..);
482482 let pos = pos_at_coords(text, Position::new(line, cursor.col)); // this func will properly truncate to line end