From 418b833d2b64ed986cfc84ca023e1a6ca5080008 Mon Sep 17 00:00:00 2001 From: Bob Date: Thu, 2 Dec 2021 12:42:34 +0800 Subject: fix goto_window index crash (#1207) --- helix-term/src/commands.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'helix-term/src') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 93703953..4a389429 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -751,8 +751,8 @@ fn goto_window(cx: &mut Context, align: Align) { Align::Center => (view.offset.row + ((last_line - view.offset.row) / 2)), Align::Bottom => last_line.saturating_sub(scrolloff + count), } - .min(last_line.saturating_sub(scrolloff)) - .max(view.offset.row + scrolloff); + .max(view.offset.row + scrolloff) + .min(last_line.saturating_sub(scrolloff)); let pos = doc.text().line_to_char(line); -- cgit v1.2.3-70-g09d2