Skip to content

Commit 30543d1

Browse files
nrabulinskigibbz00
authored andcommitted
Commit to history after executing a command from the palette (helix-editor#5294)
1 parent f57a865 commit 30543d1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

helix-term/src/commands.rs

+15
Original file line numberDiff line numberDiff line change
@@ -2507,7 +2507,22 @@ pub fn command_palette(cx: &mut Context) {
25072507
on_next_key_callback: None,
25082508
jobs: cx.jobs,
25092509
};
2510+
let focus = view!(ctx.editor).id;
2511+
25102512
command.execute(&mut ctx);
2513+
2514+
if ctx.editor.tree.contains(focus) {
2515+
let config = ctx.editor.config();
2516+
let mode = ctx.editor.mode();
2517+
let view = view_mut!(ctx.editor, focus);
2518+
let doc = doc_mut!(ctx.editor, &view.doc);
2519+
2520+
view.ensure_cursor_in_view(doc, config.scrolloff);
2521+
2522+
if mode != Mode::Insert {
2523+
doc.append_changes_to_history(view);
2524+
}
2525+
}
25112526
});
25122527
compositor.push(Box::new(overlayed(picker)));
25132528
},

0 commit comments

Comments
 (0)