fix: reset input mode when focusing views

This commit is contained in:
CJ van den Berg 2026-01-14 20:50:15 +01:00
parent 86a516630e
commit d3ae5e0e09
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 5 additions and 1 deletions

View file

@ -6835,12 +6835,14 @@ pub const EditorWidget = struct {
if (self.focused) return;
self.commands.register() catch @panic("editor.commands.register");
self.focused = true;
command.executeName("enter_mode_default", .{}) catch {};
self.editor.send_focus_events() catch {};
}
pub fn unfocus(self: *Self) void {
if (self.focused) self.commands.unregister();
self.focused = false;
command.executeName("enter_mode_default", .{}) catch {};
}
pub fn update(self: *Self) void {

View file

@ -151,14 +151,16 @@ pub fn deinit(self: *Self, allocator: std.mem.Allocator) void {
}
pub fn focus(self: *Self) void {
self.unfocus();
if (self.focused) return;
self.commands.register() catch @panic("home.commands.register");
self.focused = true;
command.executeName("enter_mode", command.Context.fmt(.{"home"})) catch {};
}
pub fn unfocus(self: *Self) void {
if (self.focused) self.commands.unregister();
self.focused = false;
command.executeName("enter_mode_default", .{}) catch {};
}
fn add_menu_command(self: *Self, command_name: []const u8, description: []const u8, hint: []const u8, menu: anytype) !void {