feat: allow setting the file type in create_scratch_buffer command

Also, fix args forwarding.
This commit is contained in:
CJ van den Berg 2025-01-27 19:50:19 +01:00
parent 404ba8bb0e
commit a706e0b976
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 16 additions and 10 deletions

View file

@ -386,12 +386,14 @@ const cmds = struct {
pub const open_gui_config_meta = .{ .description = "Edit gui configuration file" };
pub fn create_scratch_buffer(self: *Self, ctx: Ctx) Result {
const args = try ctx.args.clone(self.allocator);
defer self.allocator.free(args.buf);
tui.reset_drag_context();
try self.create_editor();
try command.executeName("open_scratch_buffer", ctx);
try command.executeName("open_scratch_buffer", .{ .args = args });
tui.need_render();
}
pub const create_scratch_buffer_meta = .{ .arguments = &.{ .string, .string } };
pub const create_scratch_buffer_meta = .{ .arguments = &.{ .string, .string, .string } };
pub fn create_new_file(self: *Self, _: Ctx) Result {
var n: usize = 1;