feat: add status message on input mode change

This commit is contained in:
CJ van den Berg 2024-03-01 22:37:51 +01:00
parent daaa524088
commit 9537c54962
6 changed files with 8 additions and 0 deletions

View file

@ -30,6 +30,7 @@ pub fn create(a: Allocator) !tui.Mode {
return .{
.handler = EventHandler.to_owned(self),
.name = root.application_logo ++ root.application_name,
.description = "default",
};
}

View file

@ -20,6 +20,7 @@ pub fn create(a: std.mem.Allocator) !tui.Mode {
return .{
.handler = EventHandler.to_owned(self),
.name = root.application_logo ++ root.application_name,
.description = "home",
};
}

View file

@ -30,6 +30,7 @@ pub fn create(a: Allocator) !tui.Mode {
return .{
.handler = EventHandler.to_owned(self),
.name = root.application_logo ++ "INSERT",
.description = "vim",
};
}

View file

@ -31,6 +31,7 @@ pub fn create(a: Allocator) !tui.Mode {
return .{
.handler = EventHandler.to_owned(self),
.name = root.application_logo ++ "NORMAL",
.description = "vim",
.line_numbers = .relative,
};
}

View file

@ -31,6 +31,7 @@ pub fn create(a: Allocator) !tui.Mode {
return .{
.handler = EventHandler.to_owned(self),
.name = root.application_logo ++ "VISUAL",
.description = "vim",
};
}

View file

@ -703,6 +703,7 @@ const cmds = struct {
self.logger.print("unknown mode {s}", .{mode});
break :ret @import("mode/input/flow.zig").create(self.a) catch |e| return tp.exit_error(e);
};
self.logger.print("input mode: {s}", .{(self.input_mode orelse return).description});
}
pub fn enter_mode_default(self: *Self, _: Ctx) tp.result {
@ -742,6 +743,7 @@ const cmds = struct {
self.input_mode = .{
.handler = mode_instance.handler(),
.name = mode_instance.name(),
.description = mode_instance.name(),
};
self.mini_mode = .{};
}
@ -759,6 +761,7 @@ const cmds = struct {
pub const Mode = struct {
handler: EventHandler,
name: []const u8,
description: []const u8,
line_numbers: enum { absolute, relative } = .absolute,
fn deinit(self: *Mode) void {