Skip to content

Commit 924de3b

Browse files
nrabulinskiShafkath Shuhan
authored and
Shafkath Shuhan
committed
Commit to history after executing a command from the palette (helix-editor#5294)
1 parent 820e469 commit 924de3b

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
@@ -2504,7 +2504,22 @@ pub fn command_palette(cx: &mut Context) {
25042504
on_next_key_callback: None,
25052505
jobs: cx.jobs,
25062506
};
2507+
let focus = view!(ctx.editor).id;
2508+
25072509
command.execute(&mut ctx);
2510+
2511+
if ctx.editor.tree.contains(focus) {
2512+
let config = ctx.editor.config();
2513+
let mode = ctx.editor.mode();
2514+
let view = view_mut!(ctx.editor, focus);
2515+
let doc = doc_mut!(ctx.editor, &view.doc);
2516+
2517+
view.ensure_cursor_in_view(doc, config.scrolloff);
2518+
2519+
if mode != Mode::Insert {
2520+
doc.append_changes_to_history(view);
2521+
}
2522+
}
25082523
});
25092524
compositor.push(Box::new(overlayed(picker)));
25102525
},

0 commit comments

Comments
 (0)