@@ -1889,12 +1889,16 @@ pub fn match_brackets(cx: &mut Context) {
18891889
18901890pub fn jump_forward(cx: &mut Context) {
18911891 let count = cx.count;
1892− let view = cx.view();
1892+ let (view, doc) = cx.current();
18931893
18941894 if let Some((id, selection)) = view.jumps.forward(count) {
1895− // TODO: position first_line so that main cursor is centered
1896− view.first_line = 0;
18971895 view.doc = *id;
1896+ let selection = selection.clone();
1897+ let cursor = selection.cursor();
1898+ doc.set_selection(view.id, selection);
1899+ // TODO: extract this centering into a function to share with _goto?
1900+ let line = doc.text().char_to_line(cursor);
1901+ view.first_line = line.saturating_sub(view.area.height as usize / 2);
18981902 };
18991903}
19001904
@@ -1903,11 +1907,13 @@ pub fn jump_backward(cx: &mut Context) {
19031907 let (view, doc) = cx.current();
19041908
19051909 if let Some((id, selection)) = view.jumps.backward(count) {
1906− // TODO: position first_line so that main cursor is centered
1907− view.first_line = 0;
19081910 view.doc = *id;
19091911 let selection = selection.clone();
1912+ let cursor = selection.cursor();
19101913 doc.set_selection(view.id, selection);
1914+ // TODO: extract this centering into a function to share with _goto?
1915+ let line = doc.text().char_to_line(cursor);
1916+ view.first_line = line.saturating_sub(view.area.height as usize / 2);
19111917 };
19121918}
19131919