From d24ca66dbb5e67ed609f7b2cf11abaee05beaef7 Mon Sep 17 00:00:00 2001 From: yzwduck Date: Sun, 5 Jun 2022 18:44:55 +0800 Subject: [PATCH] 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. --- helix-term/src/commands/lsp.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index bfedb209..8f139b3b 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -485,8 +485,6 @@ fn goto_impl( locations: Vec, 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)),