aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorNikodem RabuliƄski2023-01-16 16:41:22 +0000
committerGitHub2023-01-16 16:41:22 +0000
commit3cf5216dbd1b9c767e6a922f93f1a3b1a2955d02 (patch)
tree37ccf2c32536b8a5786e83d658d09328f29cc2d2 /helix-term
parent60f84be40c1c488dacf823f791ca33f43b5d28d8 (diff)
Commit to history after executing a command from the palette (#5294)
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands.rs15
1 files changed, 15 insertions, 0 deletions
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)));
},