refactor: simplify keybind mode create
This commit is contained in:
parent
525287c7ac
commit
ac56635f7b
11 changed files with 13 additions and 21 deletions
|
@ -5,9 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
|||
const command = @import("command");
|
||||
const EventHandler = @import("EventHandler");
|
||||
|
||||
const Allocator = @import("std").mem.Allocator;
|
||||
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
pub fn create() EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
|||
const command = @import("command");
|
||||
const EventHandler = @import("EventHandler");
|
||||
|
||||
const Allocator = @import("std").mem.Allocator;
|
||||
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
pub fn create() EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
|||
const command = @import("command");
|
||||
const EventHandler = @import("EventHandler");
|
||||
|
||||
const Allocator = @import("std").mem.Allocator;
|
||||
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
pub fn create() EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
|||
const command = @import("command");
|
||||
const EventHandler = @import("EventHandler");
|
||||
|
||||
const Allocator = @import("std").mem.Allocator;
|
||||
const fmt = @import("std").fmt;
|
||||
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
pub fn create() EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,7 @@ const event_type = @import("renderer").input.event_type;
|
|||
const command = @import("command");
|
||||
const EventHandler = @import("EventHandler");
|
||||
|
||||
const Allocator = @import("std").mem.Allocator;
|
||||
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
pub fn create() EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
pub const mode = struct {
|
||||
pub const overlay = struct {
|
||||
pub const palette = @import("overlay/palette.zig");
|
||||
};
|
||||
pub const mini = struct {
|
||||
pub const goto = @import("mini/goto.zig");
|
||||
pub const move_to_char = @import("mini/move_to_char.zig");
|
||||
|
|
|
@ -53,7 +53,7 @@ pub fn Create(options: type) type {
|
|||
options.restore_state(self) catch {};
|
||||
return .{
|
||||
.{
|
||||
.input_handler = keybind.mode.mini.file_browser.create(allocator),
|
||||
.input_handler = keybind.mode.mini.file_browser.create(),
|
||||
.event_handler = EventHandler.to_owned(self),
|
||||
},
|
||||
.{
|
||||
|
|
|
@ -49,7 +49,7 @@ pub fn create(allocator: Allocator, _: command.Context) !struct { tui.Mode, tui.
|
|||
}
|
||||
return .{
|
||||
.{
|
||||
.input_handler = keybind.mode.mini.find.create(allocator),
|
||||
.input_handler = keybind.mode.mini.find.create(),
|
||||
.event_handler = EventHandler.to_owned(self),
|
||||
},
|
||||
.{
|
||||
|
|
|
@ -43,7 +43,7 @@ pub fn create(allocator: Allocator, _: command.Context) !struct { tui.Mode, tui.
|
|||
};
|
||||
return .{
|
||||
.{
|
||||
.input_handler = keybind.mode.mini.find_in_files.create(allocator),
|
||||
.input_handler = keybind.mode.mini.find_in_files.create(),
|
||||
.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);
|
||||
return .{
|
||||
.{
|
||||
.input_handler = keybind.mode.mini.goto.create(allocator),
|
||||
.input_handler = keybind.mode.mini.goto.create(),
|
||||
.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);
|
||||
return .{
|
||||
.{
|
||||
.input_handler = keybind.mode.mini.move_to_char.create(allocator),
|
||||
.input_handler = keybind.mode.mini.move_to_char.create(),
|
||||
.event_handler = EventHandler.to_owned(self),
|
||||
},
|
||||
.{
|
||||
|
|
Loading…
Add table
Reference in a new issue