aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob2021-12-02 04:42:34 +0000
committerGitHub2021-12-02 04:42:34 +0000
commit418b833d2b64ed986cfc84ca023e1a6ca5080008 (patch)
tree808e9cdf6a01369ec90a9b29c4b82d1ab13fa38f
parentc955eaa6cd607621d8be091564b2fd6bf30f54c3 (diff)
fix goto_window index crash (#1207)
-rw-r--r--helix-term/src/commands.rs4
1 files changed, 2 insertions, 2 deletions
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);