mirror of https://github.com/helix-editor/helix
scroll: Fix the clamping
parent
06d8d3f55f
commit
bd4552cd2b
|
@ -475,8 +475,8 @@ fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
|
||||||
// clamp into viewport
|
// clamp into viewport
|
||||||
let line = cursor
|
let line = cursor
|
||||||
.row
|
.row
|
||||||
.min(view.first_line + scrolloff)
|
.max(view.first_line + scrolloff)
|
||||||
.max(last_line.saturating_sub(scrolloff));
|
.min(last_line.saturating_sub(scrolloff));
|
||||||
|
|
||||||
let text = doc.text().slice(..);
|
let text = doc.text().slice(..);
|
||||||
let pos = pos_at_coords(text, Position::new(line, cursor.col)); // this func will properly truncate to line end
|
let pos = pos_at_coords(text, Position::new(line, cursor.col)); // this func will properly truncate to line end
|
||||||
|
|
Loading…
Reference in New Issue