feat(buffers): allow deleting more than one buffer while the palette is open
This commit is contained in:
parent
1d947ab499
commit
195bad87ab
2 changed files with 12 additions and 5 deletions
|
@ -49,10 +49,10 @@ fn select(menu: **Type.MenuState, button: *Type.ButtonState) void {
|
|||
tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_path } }) catch |e| menu.*.opts.ctx.logger.err(module_name, e);
|
||||
}
|
||||
|
||||
pub fn delete_item(menu: *Type.MenuState, button: *Type.ButtonState) void {
|
||||
pub fn delete_item(menu: *Type.MenuState, button: *Type.ButtonState) bool {
|
||||
var file_path: []const u8 = undefined;
|
||||
var iter = button.opts.label;
|
||||
if (!(cbor.matchString(&iter, &file_path) catch false)) return;
|
||||
tp.self_pid().send(.{ "cmd", "exit_overlay_mode" }) catch |e| menu.*.opts.ctx.logger.err(module_name, e);
|
||||
tp.self_pid().send(.{ "cmd", "delete_buffer", .{file_path} }) catch |e| menu.*.opts.ctx.logger.err(module_name, e);
|
||||
if (!(cbor.matchString(&iter, &file_path) catch false)) return false;
|
||||
command.executeName("delete_buffer", command.fmt(.{file_path})) catch |e| menu.*.opts.ctx.logger.err(module_name, e);
|
||||
return true; //refresh list
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue