diff options
author | Brandon Dong | 2022-10-10 17:12:48 +0000 |
---|---|---|
committer | GitHub | 2022-10-10 17:12:48 +0000 |
commit | 530f9e3c5395c559e66f7b9df30552950369e42b (patch) | |
tree | d2751e71c17efe9563ca2158d07b612a18ee1e26 | |
parent | 8e8ba06f60e02c44915da633eb8e51b1eb097478 (diff) |
Fix goto/view center mismatch (#4135)
-rw-r--r-- | helix-view/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/helix-view/src/lib.rs b/helix-view/src/lib.rs index 788304bc..0145677d 100644 --- a/helix-view/src/lib.rs +++ b/helix-view/src/lib.rs @@ -53,12 +53,12 @@ pub fn align_view(doc: &Document, view: &mut View, align: Align) { .cursor(doc.text().slice(..)); let line = doc.text().char_to_line(pos); - let height = view.inner_area().height as usize; + let last_line_height = view.inner_area().height.saturating_sub(1) as usize; let relative = match align { - Align::Center => height / 2, + Align::Center => last_line_height / 2, Align::Top => 0, - Align::Bottom => height, + Align::Bottom => last_line_height, }; view.offset.row = line.saturating_sub(relative); |