diff options
author | Pascal Kuthe | 2023-02-14 19:00:54 +0000 |
---|---|---|
committer | GitHub | 2023-02-14 19:00:54 +0000 |
commit | 715c4b24d94c9e2fa70d5d59ce658b89fbde0392 (patch) | |
tree | 80658583b8de93b42595183e508a230798d5add9 /helix-term/src | |
parent | 0a7c697dd785111626c8f47a36e07381f55c2e83 (diff) |
Fix crash in goto_window_center at EOF (#5987)
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/commands.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index f8a96074..a3c9f0b4 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -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) |