Skip to content

Commit

Permalink
Fix crash in goto_window_center at EOF (helix-editor#5987)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe authored and wes-adams committed Jul 3, 2023
1 parent a3a435d commit 6f96c7e
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 6f96c7e

Please sign in to comment.