on master help sign in
Fix goto/view center mismatch (#4135)
commit530f9e3c5395c559e66f7b9df30552950369e42b authorBrandon Dong <brandondong604@hotmail.com> dateMon 10 Oct 2022, 10:12 (4 years ago) parent8e8ba06
1 file changed+3−3
helix-view/src/lib.rs+3−3
helix-view/src/lib.rs+3−3
@@ -53,12 +53,12 @@ pub fn align_view(doc: &Document, view: &mut View, align: Align) {
5353 .cursor(doc.text().slice(..));
5454 let line = doc.text().char_to_line(pos);
5555
56− let height = view.inner_area().height as usize;
56+ let last_line_height = view.inner_area().height.saturating_sub(1) as usize;
5757
5858 let relative = match align {
59− Align::Center => height / 2,
59+ Align::Center => last_line_height / 2,
6060 Align::Top => 0,
61− Align::Bottom => height,
61+ Align::Bottom => last_line_height,
6262 };
6363
6464 view.offset.row = line.saturating_sub(relative);