Commit to history after executing a command from the palette (#5294)

pull/5545/head^2
Nikodem Rabuliński 2 years ago committed by GitHub
parent 60f84be40c
commit 3cf5216dbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2504,7 +2504,22 @@ pub fn command_palette(cx: &mut Context) {
on_next_key_callback: None, on_next_key_callback: None,
jobs: cx.jobs, jobs: cx.jobs,
}; };
let focus = view!(ctx.editor).id;
command.execute(&mut ctx); 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))); compositor.push(Box::new(overlayed(picker)));
}, },

Loading…
Cancel
Save