on master help sign in
Commit to history after executing a command from the palette (#5294)
3cf5216Nikodem Rabuliński
helix-term/src/commands.rs+15
@@ -2504,7 +2504,22 @@ pub fn command_palette(cx: &mut Context) {
2504 on_next_key_callback: None,
2504 on_next_key_callback: None,
2505 jobs: cx.jobs,
2505 jobs: cx.jobs,
2506 };
2506 };
2507+ let focus = view!(ctx.editor).id;
2508+
2507 command.execute(&mut ctx);
2509 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+ }
2508 });
2523 });
2509 compositor.push(Box::new(overlayed(picker)));
2524 compositor.push(Box::new(overlayed(picker)));
2510 },
2525 },