Center the new position on screen after doing a goto jump.

This commit is contained in:
Blaž Hrastnik 2021-04-13 16:56:03 +09:00
parent 95dd55ba94
commit 2a1f10d1b5

View File

@ -1122,6 +1122,8 @@ fn jump_to(editor: &mut Editor, location: &lsp::Location, action: Action) {
let definition_pos = location.range.start;
let new_pos = lsp_pos_to_pos(doc.text(), definition_pos);
doc.set_selection(view.id, Selection::point(new_pos));
let line = doc.text().char_to_line(new_pos);
view.first_line = line.saturating_sub(view.area.height as usize / 2);
}
match locations.as_slice() {