Skip to content

Commit 530f9e3

Browse files
author
Brandon Dong
authored
Fix goto/view center mismatch (#4135)
1 parent 8e8ba06 commit 530f9e3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

helix-view/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -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);

0 commit comments

Comments
 (0)