diff --git a/src/tui/mode/overlay/open_recent.zig b/src/tui/mode/overlay/open_recent.zig index 0c5d687..603a201 100644 --- a/src/tui/mode/overlay/open_recent.zig +++ b/src/tui/mode/overlay/open_recent.zig @@ -36,6 +36,8 @@ longest: usize = 0, commands: Commands = undefined, buffer_manager: ?*BufferManager, +const inputbox_label = "Search files by name"; + pub fn create(allocator: std.mem.Allocator) !tui.Mode { const mv = tui.mainview() orelse return error.NotFound; const self = try allocator.create(Self); @@ -51,7 +53,7 @@ pub fn create(allocator: std.mem.Allocator) !tui.Mode { .logger = log.logger(@typeName(Self)), .inputbox = (try self.menu.add_header(try InputBox.create(*Self, self.allocator, self.menu.menu.parent, .{ .ctx = self, - .label = "Search files by name", + .label = inputbox_label, }))).dynamic_cast(InputBox.State(*Self)) orelse unreachable, .buffer_manager = tui.get_buffer_manager(), }; @@ -82,7 +84,7 @@ pub fn deinit(self: *Self) void { } inline fn menu_width(self: *Self) usize { - return @min(self.longest, max_menu_width()) + 2; + return @max(@min(self.longest, max_menu_width()) + 2, inputbox_label.len + 2); } inline fn menu_pos_x(self: *Self) usize { diff --git a/src/tui/mode/overlay/palette.zig b/src/tui/mode/overlay/palette.zig index 926dc65..1e0e18a 100644 --- a/src/tui/mode/overlay/palette.zig +++ b/src/tui/mode/overlay/palette.zig @@ -153,7 +153,7 @@ pub fn Create(options: type) type { fn do_resize(self: *Self) void { const screen = tui.screen(); - const w = @min(self.longest, max_menu_width) + 2 + 1 + self.longest_hint; + const w = @max(@min(self.longest, max_menu_width) + 2 + 1 + self.longest_hint, options.label.len + 2); const x = if (screen.w > w) (screen.w - w) / 2 else 0; self.view_rows = get_view_rows(screen); const h = @min(self.items + self.menu.header_count, self.view_rows + self.menu.header_count);