on master help sign in
Center the new position on screen after doing a goto jump.
commit2a1f10d1b57f88233eb48a9dbce2b56196801bd8 authorBlaž Hrastnik <blaz@mxxn.io> dateTue 13 Apr 2021, 16:56 (6 years ago) parent95dd55b
1 file changed+2
helix-term/src/commands.rs+2
helix-term/src/commands.rs+2
@@ -1122,6 +1122,8 @@ fn _goto(cx: &mut Context, locations: Vec<lsp::Location>) {
11221122 let definition_pos = location.range.start;
11231123 let new_pos = lsp_pos_to_pos(doc.text(), definition_pos);
11241124 doc.set_selection(view.id, Selection::point(new_pos));
1125+ let line = doc.text().char_to_line(new_pos);
1126+ view.first_line = line.saturating_sub(view.area.height as usize / 2);
11251127 }
11261128
11271129 match locations.as_slice() {