refactor: use the same create interface for all modes
This commit is contained in:
parent
0037695983
commit
ae3d21ad08
13 changed files with 13 additions and 13 deletions
|
@ -5,7 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
const EventHandler = @import("EventHandler");
|
const EventHandler = @import("EventHandler");
|
||||||
|
|
||||||
pub fn create() EventHandler {
|
pub fn create(_: @import("std").mem.Allocator, _: anytype) !EventHandler {
|
||||||
return EventHandler.static(@This());
|
return EventHandler.static(@This());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
const EventHandler = @import("EventHandler");
|
const EventHandler = @import("EventHandler");
|
||||||
|
|
||||||
pub fn create() EventHandler {
|
pub fn create(_: @import("std").mem.Allocator, _: anytype) !EventHandler {
|
||||||
return EventHandler.static(@This());
|
return EventHandler.static(@This());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
const EventHandler = @import("EventHandler");
|
const EventHandler = @import("EventHandler");
|
||||||
|
|
||||||
pub fn create() EventHandler {
|
pub fn create(_: @import("std").mem.Allocator, _: anytype) !EventHandler {
|
||||||
return EventHandler.static(@This());
|
return EventHandler.static(@This());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
const EventHandler = @import("EventHandler");
|
const EventHandler = @import("EventHandler");
|
||||||
|
|
||||||
pub fn create() EventHandler {
|
pub fn create(_: @import("std").mem.Allocator, _: anytype) !EventHandler {
|
||||||
return EventHandler.static(@This());
|
return EventHandler.static(@This());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
const EventHandler = @import("EventHandler");
|
const EventHandler = @import("EventHandler");
|
||||||
|
|
||||||
pub fn create() EventHandler {
|
pub fn create(_: @import("std").mem.Allocator, _: anytype) !EventHandler {
|
||||||
return EventHandler.static(@This());
|
return EventHandler.static(@This());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
||||||
const command = @import("command");
|
const command = @import("command");
|
||||||
const EventHandler = @import("EventHandler");
|
const EventHandler = @import("EventHandler");
|
||||||
|
|
||||||
pub fn create() EventHandler {
|
pub fn create(_: @import("std").mem.Allocator, _: anytype) !EventHandler {
|
||||||
return EventHandler.static(@This());
|
return EventHandler.static(@This());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub fn Create(options: type) type {
|
||||||
options.restore_state(self) catch {};
|
options.restore_state(self) catch {};
|
||||||
return .{
|
return .{
|
||||||
.{
|
.{
|
||||||
.input_handler = keybind.mode.mini.file_browser.create(),
|
.input_handler = try keybind.mode.mini.file_browser.create(allocator, .{}),
|
||||||
.event_handler = EventHandler.to_owned(self),
|
.event_handler = EventHandler.to_owned(self),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
|
|
|
@ -49,7 +49,7 @@ pub fn create(allocator: Allocator, _: command.Context) !struct { tui.Mode, tui.
|
||||||
}
|
}
|
||||||
return .{
|
return .{
|
||||||
.{
|
.{
|
||||||
.input_handler = keybind.mode.mini.find.create(),
|
.input_handler = try keybind.mode.mini.find.create(allocator, .{}),
|
||||||
.event_handler = EventHandler.to_owned(self),
|
.event_handler = EventHandler.to_owned(self),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub fn create(allocator: Allocator, _: command.Context) !struct { tui.Mode, tui.
|
||||||
};
|
};
|
||||||
return .{
|
return .{
|
||||||
.{
|
.{
|
||||||
.input_handler = keybind.mode.mini.find_in_files.create(),
|
.input_handler = try keybind.mode.mini.find_in_files.create(allocator, .{}),
|
||||||
.event_handler = EventHandler.to_owned(self),
|
.event_handler = EventHandler.to_owned(self),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub fn create(allocator: Allocator, _: command.Context) !struct { tui.Mode, tui.
|
||||||
try self.commands.init(self);
|
try self.commands.init(self);
|
||||||
return .{
|
return .{
|
||||||
.{
|
.{
|
||||||
.input_handler = keybind.mode.mini.goto.create(),
|
.input_handler = try keybind.mode.mini.goto.create(allocator, .{}),
|
||||||
.event_handler = EventHandler.to_owned(self),
|
.event_handler = EventHandler.to_owned(self),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
|
|
|
@ -46,7 +46,7 @@ pub fn create(allocator: Allocator, ctx: command.Context) !struct { tui.Mode, tu
|
||||||
try self.commands.init(self);
|
try self.commands.init(self);
|
||||||
return .{
|
return .{
|
||||||
.{
|
.{
|
||||||
.input_handler = keybind.mode.mini.move_to_char.create(),
|
.input_handler = try keybind.mode.mini.move_to_char.create(allocator, .{}),
|
||||||
.event_handler = EventHandler.to_owned(self),
|
.event_handler = EventHandler.to_owned(self),
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
|
|
|
@ -63,7 +63,7 @@ pub fn create(allocator: std.mem.Allocator) !tui.Mode {
|
||||||
try mv.floating_views.add(self.modal.widget());
|
try mv.floating_views.add(self.modal.widget());
|
||||||
try mv.floating_views.add(self.menu.container_widget);
|
try mv.floating_views.add(self.menu.container_widget);
|
||||||
return .{
|
return .{
|
||||||
.input_handler = keybind.mode.overlay.palette.create(),
|
.input_handler = try keybind.mode.overlay.palette.create(allocator, .{}),
|
||||||
.event_handler = EventHandler.to_owned(self),
|
.event_handler = EventHandler.to_owned(self),
|
||||||
.name = " open recent",
|
.name = " open recent",
|
||||||
};
|
};
|
||||||
|
|
|
@ -85,7 +85,7 @@ pub fn Create(options: type) type {
|
||||||
try mv.floating_views.add(self.modal.widget());
|
try mv.floating_views.add(self.modal.widget());
|
||||||
try mv.floating_views.add(self.menu.container_widget);
|
try mv.floating_views.add(self.menu.container_widget);
|
||||||
return .{
|
return .{
|
||||||
.input_handler = keybind.mode.overlay.palette.create(),
|
.input_handler = try keybind.mode.overlay.palette.create(allocator, .{}),
|
||||||
.event_handler = EventHandler.to_owned(self),
|
.event_handler = EventHandler.to_owned(self),
|
||||||
.name = options.name,
|
.name = options.name,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue