Skip to content

Commit

Permalink
Fix crash in goto_window_center at EOF (#5987)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe committed Feb 14, 2023
1 parent 0a7c697 commit 715c4b2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,10 +960,9 @@ fn goto_window(cx: &mut Context, align: Align) {
view.offset.vertical_offset + last_visual_line.saturating_sub(scrolloff + count)
}
};
let visual_line = visual_line.clamp(
view.offset.vertical_offset + scrolloff,
view.offset.vertical_offset + last_visual_line.saturating_sub(scrolloff),
);
let visual_line = visual_line
.max(view.offset.vertical_offset + scrolloff)
.min(view.offset.vertical_offset + last_visual_line.saturating_sub(scrolloff));

let pos = view
.pos_at_visual_coords(doc, visual_line as u16, 0, false)
Expand Down

0 comments on commit 715c4b2

Please sign in to comment.