refactor: move mode.event_handler back to input mode
This commit is contained in:
parent
d06ebd0dd5
commit
525287c7ac
22 changed files with 47 additions and 51 deletions
|
@ -7,10 +7,8 @@ const EventHandler = @import("EventHandler");
|
|||
|
||||
const Allocator = @import("std").mem.Allocator;
|
||||
|
||||
const Mode = @import("../root.zig").Mode;
|
||||
|
||||
pub fn create(_: Allocator) !Mode {
|
||||
return .{ .handler = EventHandler.static(@This()) };
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
pub fn receive(_: tp.pid_ref, m: tp.message) error{Exit}!bool {
|
||||
|
|
|
@ -7,10 +7,8 @@ const EventHandler = @import("EventHandler");
|
|||
|
||||
const Allocator = @import("std").mem.Allocator;
|
||||
|
||||
const Mode = @import("../root.zig").Mode;
|
||||
|
||||
pub fn create(_: Allocator) !Mode {
|
||||
return .{ .handler = EventHandler.static(@This()) };
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
pub fn receive(_: tp.pid_ref, m: tp.message) error{Exit}!bool {
|
||||
|
|
|
@ -7,10 +7,8 @@ const EventHandler = @import("EventHandler");
|
|||
|
||||
const Allocator = @import("std").mem.Allocator;
|
||||
|
||||
const Mode = @import("../root.zig").Mode;
|
||||
|
||||
pub fn create(_: Allocator) !Mode {
|
||||
return .{ .handler = EventHandler.static(@This()) };
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
pub fn receive(_: tp.pid_ref, m: tp.message) error{Exit}!bool {
|
||||
|
|
|
@ -8,10 +8,8 @@ const EventHandler = @import("EventHandler");
|
|||
const Allocator = @import("std").mem.Allocator;
|
||||
const fmt = @import("std").fmt;
|
||||
|
||||
const Mode = @import("../root.zig").Mode;
|
||||
|
||||
pub fn create(_: Allocator) error{OutOfMemory}!Mode {
|
||||
return .{ .handler = EventHandler.static(@This()) };
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
pub fn receive(_: tp.pid_ref, m: tp.message) error{Exit}!bool {
|
||||
|
|
|
@ -7,10 +7,8 @@ const EventHandler = @import("EventHandler");
|
|||
|
||||
const Allocator = @import("std").mem.Allocator;
|
||||
|
||||
const Mode = @import("../root.zig").Mode;
|
||||
|
||||
pub fn create(_: Allocator) !Mode {
|
||||
return .{ .handler = EventHandler.static(@This()) };
|
||||
pub fn create(_: Allocator) EventHandler {
|
||||
return EventHandler.static(@This());
|
||||
}
|
||||
|
||||
pub fn receive(_: tp.pid_ref, m: tp.message) error{Exit}!bool {
|
||||
|
|
|
@ -9,14 +9,17 @@ pub const mode = struct {
|
|||
};
|
||||
|
||||
pub const Mode = struct {
|
||||
handler: EventHandler,
|
||||
input_handler: EventHandler,
|
||||
event_handler: ?EventHandler = null,
|
||||
|
||||
name: []const u8 = "",
|
||||
line_numbers: enum { absolute, relative } = .absolute,
|
||||
keybind_hints: ?*const KeybindHints = null,
|
||||
cursor_shape: renderer.CursorShape = .block,
|
||||
|
||||
pub fn deinit(self: *Mode) void {
|
||||
self.handler.deinit();
|
||||
self.input_handler.deinit();
|
||||
if (self.event_handler) |eh| eh.deinit();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue