refactor: move goto mini mode keybindings to keybind module

This commit is contained in:
CJ van den Berg 2024-10-25 22:40:58 +02:00
parent 16c5471126
commit 49319d6207
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
5 changed files with 176 additions and 90 deletions

View file

@ -10,6 +10,7 @@ const builtin = @import("builtin");
pub const renderer = @import("renderer");
const command = @import("command");
const EventHandler = @import("EventHandler");
const keybind = @import("keybind");
const Widget = @import("Widget.zig");
const MessageFilter = @import("MessageFilter.zig");
@ -755,25 +756,13 @@ const cmds = struct {
pub const exit_mini_mode_meta = .{ .interactive = false };
};
pub const Mode = struct {
handler: EventHandler,
name: []const u8,
description: []const u8,
line_numbers: enum { absolute, relative } = .absolute,
keybind_hints: ?*const KeybindHints = null,
cursor_shape: renderer.CursorShape = .block,
fn deinit(self: *Mode) void {
self.handler.deinit();
}
};
pub const MiniMode = struct {
event_handler: ?EventHandler = null,
text: []const u8 = "",
cursor: ?usize = null,
};
pub const Mode = keybind.Mode;
pub const KeybindHints = std.static_string_map.StaticStringMap([]const u8);
threadlocal var instance_: ?*Self = null;