@@ -240,8 +240,6 @@ pub fn move_next_word_end(cx: &mut Context) {
240240pub fn move_file_start(cx: &mut Context) {
241241 let doc = cx.doc();
242242 doc.set_selection(Selection::point(0));
243−
244− doc.mode = Mode::Normal;
245243}
246244
247245pub fn move_file_end(cx: &mut Context) {
@@ -249,8 +247,6 @@ pub fn move_file_end(cx: &mut Context) {
249247 let text = doc.text();
250248 let last_line = text.line_to_char(text.len_lines().saturating_sub(2));
251249 doc.set_selection(Selection::point(last_line));
252−
253− doc.mode = Mode::Normal;
254250}
255251
256252pub fn extend_next_word_start(cx: &mut Context) {
@@ -1072,35 +1068,31 @@ pub fn exit_select_mode(cx: &mut Context) {
10721068
10731069fn _goto(cx: &mut Context, locations: Vec<lsp::Location>) {
10741070 use helix_view::editor::Action;
1075− cx.doc().mode = Mode::Normal;
1071+
1072+ fn jump_to(editor: &mut Editor, location: &lsp::Location, action: Action) {
1073+ let id = editor
1074+ .open(PathBuf::from(location.uri.path()), action)
1075+ .expect("editor.open failed");
1076+ let doc = &mut editor.documents[id];
1077+ let definition_pos = location.range.start;
1078+ let new_pos = helix_lsp::util::lsp_pos_to_pos(doc.text(), definition_pos);
1079+ doc.set_selection(Selection::point(new_pos));
1080+ }
10761081
10771082 match locations.as_slice() {
10781083 [location] => {
1079− cx.editor
1080− .open(PathBuf::from(location.uri.path()), Action::Replace);
1081− let doc = cx.doc();
1082− let definition_pos = location.range.start;
1083− let new_pos = helix_lsp::util::lsp_pos_to_pos(doc.text(), definition_pos);
1084− doc.set_selection(Selection::point(new_pos));
1084+ jump_to(cx.editor, location, Action::Replace);
10851085 }
10861086 [] => (), // maybe show user message that no definition was found?
10871087 _locations => {
10881088 let mut picker = ui::Picker::new(
10891089 locations,
1090− |item| {
1091− let file = item.uri.as_str();
1092− let line = item.range.start.line;
1090+ |location| {
1091+ let file = location.uri.as_str();
1092+ let line = location.range.start.line;
10931093 format!("{}:{}", file, line).into()
10941094 },
1095− move |editor: &mut Editor, item, action| {
1096− let id = editor
1097− .open(PathBuf::from(item.uri.path()), action)
1098− .expect("editor.open failed");
1099− let doc = &mut editor.documents[id];
1100− let definition_pos = item.range.start;
1101− let new_pos = helix_lsp::util::lsp_pos_to_pos(doc.text(), definition_pos);
1102− doc.set_selection(Selection::point(new_pos));
1103− },
1095+ move |editor: &mut Editor, location, action| jump_to(editor, location, action),
11041096 );
11051097 cx.push_layer(Box::new(picker));
11061098 }
@@ -1797,5 +1789,8 @@ pub fn jump_backward(cx: &mut Context) {
17971789 if let Some((id, selection)) = view.jumps.backward(count) {
17981790 view.first_line = 0;
17991791 view.doc = *id;
1792+ let selection = selection.clone();
1793+ let doc = cx.doc();
1794+ doc.set_selection(selection);
18001795 };
18011796}