on master help sign in
Commit to history after executing a command from the palette (#5294)
commit3cf5216dbd1b9c767e6a922f93f1a3b1a2955d02 authorNikodem Rabuliński <nikodem@rabulinski.com> dateMon 16 Jan 2023, 17:41 (4 years ago) parent60f84be
1 file changed+15
helix-term/src/commands.rs+15
helix-term/src/commands.rs+15
@@ -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 },