Compare commits
No commits in common. "a532665afbe1055db7eeca6346fae50aa12d0b59" and "f34285d2aa0007dc2049f76fb098f23173d15302" have entirely different histories.
a532665afb
...
f34285d2aa
3 changed files with 1 additions and 26 deletions
|
|
@ -18,20 +18,11 @@ pub const Context = struct {
|
|||
cbor.writeValue(&context_buffer.writer, value) catch @panic("command.Context.fmt failed");
|
||||
return .{ .args = .{ .buf = context_buffer.written() } };
|
||||
}
|
||||
|
||||
fn fmtbuf(buf: []u8, value: anytype) error{CommandContextBufferNoSpaceLeft}!Context {
|
||||
var writer: std.Io.Writer = .fixed(buf);
|
||||
cbor.writeValue(&writer, value) catch |e| return switch (e) {
|
||||
error.WriteFailed => error.CommandContextBufferNoSpaceLeft,
|
||||
};
|
||||
return .{ .args = .{ .buf = writer.buffered() } };
|
||||
}
|
||||
};
|
||||
|
||||
const context_buffer_allocator = std.heap.c_allocator;
|
||||
threadlocal var context_buffer: std.Io.Writer.Allocating = .init(context_buffer_allocator);
|
||||
pub const fmt = Context.fmt;
|
||||
pub const fmtbuf = Context.fmtbuf;
|
||||
|
||||
const Vtable = struct {
|
||||
id: ID = ID_unknown,
|
||||
|
|
|
|||
|
|
@ -724,21 +724,6 @@ const cmds = struct {
|
|||
const args = try ctx.args.clone(self.allocator);
|
||||
defer self.allocator.free(args.buf);
|
||||
tui.reset_drag_context();
|
||||
|
||||
var file_path: []const u8 = undefined;
|
||||
if (ctx.args.match(.{ tp.extract(&file_path), tp.string, tp.string }) catch false or
|
||||
ctx.args.match(.{ tp.extract(&file_path), tp.string }) catch false or
|
||||
ctx.args.match(.{tp.extract(&file_path)}) catch false)
|
||||
{
|
||||
if (self.buffer_manager.get_buffer_for_file(file_path)) |_| {
|
||||
var buf: [tp.max_message_size]u8 = undefined;
|
||||
try command.executeName("navigate", try command.fmtbuf(&buf, .{ .file = file_path }));
|
||||
tui.need_render(@src());
|
||||
self.location_update_from_editor();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try self.create_editor();
|
||||
try command.executeName("open_scratch_buffer", .{ .args = args });
|
||||
tui.need_render(@src());
|
||||
|
|
|
|||
|
|
@ -1354,8 +1354,7 @@ const cmds = struct {
|
|||
defer buffer_name.deinit();
|
||||
buffer_name.writer.print("*{s}*", .{cmd}) catch {};
|
||||
call_add_task(task);
|
||||
var buf: [tp.max_message_size]u8 = undefined;
|
||||
try command.executeName("create_scratch_buffer", try command.fmtbuf(&buf, .{ buffer_name.written(), "", "conf" }));
|
||||
tp.self_pid().send(.{ "cmd", "create_scratch_buffer", .{ buffer_name.written(), "", "conf" } }) catch |e| self.logger.err("task", e);
|
||||
tp.self_pid().send(.{ "cmd", "shell_execute_stream", .{cmd} }) catch |e| self.logger.err("task", e);
|
||||
} else {
|
||||
return self.enter_overlay_mode(@import("mode/overlay/task_palette.zig").Type);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue