Avoid modifying jumplist until jumping to ref (#2670)

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.
imgbot
yzwduck 2 years ago committed by GitHub
parent 026241cf72
commit d24ca66dbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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() {
@ -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)),

Loading…
Cancel
Save