Skip to content

Commit

Permalink
Commit to history after executing a command from the palette (#5294)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrabulinski authored Jan 16, 2023
1 parent 60f84be commit 3cf5216
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
},
Expand Down

0 comments on commit 3cf5216

Please sign in to comment.