feat: navigate_split_vertical on shift+enter in buffer palette
This commit is contained in:
parent
20b5711fbb
commit
ea2b2f7b19
3 changed files with 17 additions and 3 deletions
|
|
@ -63,7 +63,11 @@ fn select(menu: **Type.MenuType, button: *Type.ButtonType, _: Type.Pos) void {
|
|||
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", "navigate", .{ .file = file_path } }) catch |e| menu.*.opts.ctx.logger.err(module_name, e);
|
||||
const cmd_ = switch (menu.*.opts.ctx.activate) {
|
||||
.normal => "navigate",
|
||||
.alternate => "navigate_split_vertical",
|
||||
};
|
||||
tp.self_pid().send(.{ "cmd", cmd_, .{ .file = file_path } }) catch |e| menu.*.opts.ctx.logger.err(module_name, e);
|
||||
}
|
||||
|
||||
pub fn delete_item(menu: *Type.MenuType, button: *Type.ButtonType) bool {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ pub const Placement = enum {
|
|||
primary_cursor,
|
||||
};
|
||||
|
||||
pub const ActivateMode = enum {
|
||||
normal,
|
||||
alternate,
|
||||
};
|
||||
|
||||
pub fn Create(options: type) type {
|
||||
return struct {
|
||||
allocator: std.mem.Allocator,
|
||||
|
|
@ -44,6 +49,7 @@ pub fn Create(options: type) type {
|
|||
initial_selected: ?usize = null,
|
||||
placement: Placement,
|
||||
quick_activate_enabled: bool = true,
|
||||
activate: ActivateMode = .normal,
|
||||
|
||||
items: usize = 0,
|
||||
view_rows: usize,
|
||||
|
|
@ -580,6 +586,12 @@ pub fn Create(options: type) type {
|
|||
}
|
||||
pub const palette_menu_activate_meta: Meta = .{};
|
||||
|
||||
pub fn palette_menu_activate_alternate(self: *Self, _: Ctx) Result {
|
||||
self.activate = .alternate;
|
||||
self.menu.activate_selected();
|
||||
}
|
||||
pub const palette_menu_activate_alternate_meta: Meta = .{};
|
||||
|
||||
pub fn palette_menu_activate_quick(self: *Self, _: Ctx) Result {
|
||||
if (!self.quick_activate_enabled) return;
|
||||
if (self.menu.selected orelse 0 > 0) self.menu.activate_selected();
|
||||
|
|
|
|||
|
|
@ -1659,7 +1659,6 @@ const cmds = struct {
|
|||
self.rdr_.request_mouse_cursor_text(true);
|
||||
}
|
||||
pub const disable_jump_mode_meta: Meta = .{};
|
||||
|
||||
};
|
||||
|
||||
pub const MiniMode = struct {
|
||||
|
|
@ -2501,4 +2500,3 @@ pub fn jump_mode() bool {
|
|||
const self = current();
|
||||
return self.jump_mode_;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue