mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-20 05:57:06 +04:00
Center the new position on screen after doing a goto jump.
This commit is contained in:
parent
95dd55ba94
commit
2a1f10d1b5
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user