@@ -1889,12 +1889,16 @@ pub fn match_brackets(cx: &mut Context) {
1890pub fn jump_forward(cx: &mut Context) {
1890pub fn jump_forward(cx: &mut Context) {
1891 let count = cx.count;
1891 let count = cx.count;
1892− let view = cx.view();
1892+ let (view, doc) = cx.current();
1894 if let Some((id, selection)) = view.jumps.forward(count) {
1894 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;
1897 view.doc = *id;
1895 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);
@@ -1903,11 +1907,13 @@ pub fn jump_backward(cx: &mut Context) {
1903 let (view, doc) = cx.current();
1907 let (view, doc) = cx.current();
1905 if let Some((id, selection)) = view.jumps.backward(count) {
1909 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;
1908 view.doc = *id;
1910 view.doc = *id;
1909 let selection = selection.clone();
1911 let selection = selection.clone();
1912+ let cursor = selection.cursor();
1910 doc.set_selection(view.id, selection);
1913 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);