From 3cf5216dbd1b9c767e6a922f93f1a3b1a2955d02 Mon Sep 17 00:00:00 2001 From: Nikodem RabuliƄski Date: Mon, 16 Jan 2023 17:41:22 +0100 Subject: Commit to history after executing a command from the palette (#5294) --- helix-term/src/commands.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'helix-term/src') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index e196e71e..7df53a48 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2504,7 +2504,22 @@ pub fn command_palette(cx: &mut Context) { on_next_key_callback: None, jobs: cx.jobs, }; + let focus = view!(ctx.editor).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))); }, -- cgit v1.2.3-70-g09d2