From d3ae5e0e092184eec277ada2b161658301993b64 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 14 Jan 2026 20:50:15 +0100 Subject: [PATCH] fix: reset input mode when focusing views --- src/tui/editor.zig | 2 ++ src/tui/home.zig | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index cd4c823..0c609c7 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -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 { diff --git a/src/tui/home.zig b/src/tui/home.zig index 6093c2b..b0d0c29 100644 --- a/src/tui/home.zig +++ b/src/tui/home.zig @@ -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 {