Skip to content

Commit

Permalink
Fix goto/view center mismatch (helix-editor#4135)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Dong authored and pathwave committed Nov 4, 2022
1 parent 75f6acc commit fdec691
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions helix-view/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,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);
Expand Down

0 comments on commit fdec691

Please sign in to comment.