feat: add config options to disable scrollbars and/or file icons

This commit is contained in:
CJ van den Berg 2025-03-06 17:11:49 +01:00
parent e70972f357
commit a5bf57e0e6
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
8 changed files with 26 additions and 11 deletions

View file

@ -6,6 +6,7 @@ const WidgetList = @import("WidgetList.zig");
const Button = @import("Button.zig");
const scrollbar_v = @import("scrollbar_v.zig");
const Plane = @import("renderer").Plane;
const tui = @import("tui.zig");
pub const Container = WidgetList;
pub const scroll_lines = 3;
@ -61,7 +62,10 @@ pub fn create(ctx_type: type, allocator: std.mem.Allocator, parent: Plane, opts:
.menu = try WidgetList.createV(allocator, container.plane, @typeName(@This()), .dynamic),
.container = container,
.container_widget = container.widget(),
.scrollbar = if (opts.on_scroll) |on_scroll| (try scrollbar_v.create(allocator, parent, null, on_scroll)).dynamic_cast(scrollbar_v).? else null,
.scrollbar = if (tui.config().show_scrollbars)
if (opts.on_scroll) |on_scroll| (try scrollbar_v.create(allocator, parent, null, on_scroll)).dynamic_cast(scrollbar_v).? else null
else
null,
.opts = opts,
};
self.menu.ctx = self;