From db663bdb0807fb7b46a0ee057e8ef34e78c70f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Mon, 26 Dec 2022 12:21:10 +0100 Subject: [PATCH 1/2] Added commiting to history after executing a command from the palette --- helix-term/src/commands.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 437e11b5c238..3bdf06cf0039 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2509,7 +2509,23 @@ pub fn command_palette(cx: &mut Context) { on_next_key_callback: None, jobs: cx.jobs, }; + let (view, _) = current!(ctx.editor); + let focus = view.id; + command.execute(&mut ctx); + + if ctx.editor.tree.contains(focus) { + let config = ctx.editor.config(); + let mode = ctx.editor.mode(); + let view = view_mut!(ctx.editor, focus); + let doc = doc_mut!(ctx.editor, &view.doc); + + view.ensure_cursor_in_view(doc, config.scrolloff); + + if mode != Mode::Insert { + doc.append_changes_to_history(view); + } + } }); compositor.push(Box::new(overlayed(picker))); }, From 6dcb05ab618bdb205a9c6d251edd417cd0385c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Wed, 11 Jan 2023 07:32:02 +0100 Subject: [PATCH 2/2] Update helix-term/src/commands.rs Co-authored-by: Michael Davis --- helix-term/src/commands.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 3bdf06cf0039..df21fad1f31b 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2509,8 +2509,7 @@ pub fn command_palette(cx: &mut Context) { on_next_key_callback: None, jobs: cx.jobs, }; - let (view, _) = current!(ctx.editor); - let focus = view.id; + let focus = view!(ctx.editor).id; command.execute(&mut ctx);