Skip to content

Commit fdec691

Browse files
Brandon Dongpathwave
Brandon Dong
authored andcommitted
Fix goto/view center mismatch (helix-editor#4135)
1 parent 75f6acc commit fdec691

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
@@ -54,12 +54,12 @@ pub fn align_view(doc: &Document, view: &mut View, align: Align) {
5454
.cursor(doc.text().slice(..));
5555
let line = doc.text().char_to_line(pos);
5656

57-
let height = view.inner_area().height as usize;
57+
let last_line_height = view.inner_area().height.saturating_sub(1) as usize;
5858

5959
let relative = match align {
60-
Align::Center => height / 2,
60+
Align::Center => last_line_height / 2,
6161
Align::Top => 0,
62-
Align::Bottom => height,
62+
Align::Bottom => last_line_height,
6363
};
6464

6565
view.offset.row = line.saturating_sub(relative);

0 commit comments

Comments
 (0)