feat: make mode/namespace loading more dynamic and add fallback handling
This commit is contained in:
parent
27613eab1f
commit
94fb5119ef
12 changed files with 152 additions and 130 deletions
|
@ -48,7 +48,7 @@ pub fn Create(options: type) type {
|
|||
try options.load_entries(self);
|
||||
if (@hasDecl(options, "restore_state"))
|
||||
options.restore_state(self) catch {};
|
||||
const input_handler, const keybind_hints = try keybind.mode.mini.file_browser.create(allocator, .{
|
||||
const input_handler, const keybind_hints = try keybind.mode("mini/file_browser", allocator, .{
|
||||
.insert_command = "mini_mode_insert_bytes",
|
||||
});
|
||||
return .{
|
||||
|
|
|
@ -44,7 +44,7 @@ pub fn create(allocator: Allocator, _: command.Context) !struct { tui.Mode, tui.
|
|||
defer self.allocator.free(text);
|
||||
try self.input.appendSlice(text);
|
||||
}
|
||||
const input_handler, const keybind_hints = try keybind.mode.mini.find.create(allocator, .{
|
||||
const input_handler, const keybind_hints = try keybind.mode("mini/find", allocator, .{
|
||||
.insert_command = "mini_mode_insert_bytes",
|
||||
});
|
||||
return .{
|
||||
|
|
|
@ -38,7 +38,7 @@ pub fn create(allocator: Allocator, _: command.Context) !struct { tui.Mode, tui.
|
|||
@memcpy(self.buf[0..text.len], text);
|
||||
self.input = self.buf[0..text.len];
|
||||
};
|
||||
const input_handler, const keybind_hints = try keybind.mode.mini.find_in_files.create(allocator, .{
|
||||
const input_handler, const keybind_hints = try keybind.mode("mini/find_in_files", allocator, .{
|
||||
.insert_command = "mini_mode_insert_bytes",
|
||||
});
|
||||
return .{
|
||||
|
|
|
@ -32,7 +32,7 @@ pub fn create(allocator: Allocator, _: command.Context) !struct { tui.Mode, tui.
|
|||
.start = editor.get_primary().cursor.row + 1,
|
||||
};
|
||||
try self.commands.init(self);
|
||||
const input_handler, const keybind_hints = try keybind.mode.mini.goto.create(allocator, .{
|
||||
const input_handler, const keybind_hints = try keybind.mode("mini/goto", allocator, .{
|
||||
.insert_command = "mini_mode_insert_bytes",
|
||||
});
|
||||
return .{
|
||||
|
|
|
@ -41,7 +41,7 @@ pub fn create(allocator: Allocator, ctx: command.Context) !struct { tui.Mode, tu
|
|||
.operation = if (select) .select else .move,
|
||||
};
|
||||
try self.commands.init(self);
|
||||
const input_handler, const keybind_hints = try keybind.mode.mini.move_to_char.create(allocator, .{
|
||||
const input_handler, const keybind_hints = try keybind.mode("mini/move_to_char", allocator, .{
|
||||
.insert_command = "mini_mode_insert_bytes",
|
||||
});
|
||||
return .{
|
||||
|
|
|
@ -59,7 +59,7 @@ pub fn create(allocator: std.mem.Allocator) !tui.Mode {
|
|||
self.menu.resize(.{ .y = 0, .x = self.menu_pos_x(), .w = max_menu_width() + 2 });
|
||||
try mv.floating_views.add(self.modal.widget());
|
||||
try mv.floating_views.add(self.menu.container_widget);
|
||||
const input_handler, const keybind_hints = try keybind.mode.overlay.palette.create(allocator, .{
|
||||
const input_handler, const keybind_hints = try keybind.mode("overlay/palette", allocator, .{
|
||||
.insert_command = "overlay_insert_bytes",
|
||||
});
|
||||
return .{
|
||||
|
|
|
@ -82,7 +82,7 @@ pub fn Create(options: type) type {
|
|||
try self.start_query();
|
||||
try mv.floating_views.add(self.modal.widget());
|
||||
try mv.floating_views.add(self.menu.container_widget);
|
||||
const input_handler, const keybind_hints = try keybind.mode.overlay.palette.create(allocator, .{
|
||||
const input_handler, const keybind_hints = try keybind.mode("overlay/palette", allocator, .{
|
||||
.insert_command = "overlay_insert_bytes",
|
||||
});
|
||||
return .{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue