Skip to content

Commit

Permalink
Avoid modifying jumplist until jumping to ref (#2670)
Browse files Browse the repository at this point in the history
When a goto command is cancelled, the jumplist should remain unchanged.

This commit delays saving the current selection to the jumplist until
jumping to a reference.
  • Loading branch information
yzwduck authored Jun 5, 2022
1 parent 026241c commit d24ca66
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions helix-term/src/commands/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,6 @@ fn goto_impl(
locations: Vec<lsp::Location>,
offset_encoding: OffsetEncoding,
) {
push_jump(editor);

let cwdir = std::env::current_dir().expect("couldn't determine current directory");

match locations.as_slice() {
Expand Down Expand Up @@ -520,6 +518,7 @@ fn goto_impl(
format!("{}:{}", file, line).into()
},
move |cx, location, action| {
push_jump(cx.editor);
jump_to_location(cx.editor, location, offset_encoding, action)
},
move |_editor, location| Some(location_to_file_location(location)),
Expand Down

0 comments on commit d24ca66

Please sign in to comment.