@@ -733,10 +733,12 @@ fn align_fragment_to_width(fragment: &str, width: usize, align_style: usize) ->
733733}
734734
735735fn goto_window(cx: &mut Context, align: Align) {
736+ let count = cx.count() - 1;
736737 let (view, doc) = current!(cx.editor);
737738
738739 let height = view.inner_area().height as usize;
739740
741+ // respect user given count if any
740742 // - 1 so we have at least one gap in the middle.
741743 // a height of 6 with padding of 3 on each side will keep shifting the view back and forth
742744 // as we type
@@ -745,11 +747,12 @@ fn goto_window(cx: &mut Context, align: Align) {
745747 let last_line = view.last_line(doc);
746748
747749 let line = match align {
748− Align::Top => (view.offset.row + scrolloff),
749− Align::Center => (view.offset.row + (height / 2)),
750− Align::Bottom => last_line.saturating_sub(scrolloff),
750+ Align::Top => (view.offset.row + scrolloff + count),
751+ Align::Center => (view.offset.row + ((last_line - view.offset.row) / 2)),
752+ Align::Bottom => last_line.saturating_sub(scrolloff + count),
751753 }
752− .min(last_line.saturating_sub(scrolloff));
754+ .min(last_line.saturating_sub(scrolloff))
755+ .max(view.offset.row + scrolloff);
753756
754757 let pos = doc.text().line_to_char(line);
755758