fix: reset input mode when focusing views
This commit is contained in:
parent
86a516630e
commit
d3ae5e0e09
2 changed files with 5 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue