From 1f67c8e2cee0f7cae046f2a7fe75d00fb2e61959 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 18 Dec 2025 15:22:48 +0100 Subject: [PATCH] refactor: add dropdown widget type --- src/config.zig | 2 ++ src/tui/WidgetStyle.zig | 1 + src/tui/tui.zig | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/config.zig b/src/config.zig index ac1226d..e14b931 100644 --- a/src/config.zig +++ b/src/config.zig @@ -53,6 +53,7 @@ start_debugger_on_crash: bool = false, widget_style: WidgetStyle = .compact, palette_style: WidgetStyle = .bars_top_bottom, +dropdown_style: WidgetStyle = .compact, panel_style: WidgetStyle = .compact, home_style: WidgetStyle = .bars_top_bottom, pane_left_style: WidgetStyle = .bar_right, @@ -103,6 +104,7 @@ pub const WidgetType = enum { pane_left, pane_right, hint_window, + dropdown, }; pub const WidgetStyle = enum { diff --git a/src/tui/WidgetStyle.zig b/src/tui/WidgetStyle.zig index 4d010ac..f550ee3 100644 --- a/src/tui/WidgetStyle.zig +++ b/src/tui/WidgetStyle.zig @@ -158,6 +158,7 @@ pub fn theme_style_from_type(style_type: WidgetType, theme: *const Theme) Theme. .none => theme.editor, .palette => .{ .fg = theme.editor_widget_border.fg, .bg = theme.editor_widget.bg }, .panel => .{ .fg = theme.editor_widget_border.fg, .bg = theme.editor.bg }, + .dropdown => .{ .fg = theme.editor_widget_border.fg, .bg = theme.editor.bg }, .home => .{ .fg = theme.editor_widget_border.fg, .bg = theme.editor.bg }, .pane_left => switch (tui.config().pane_style) { .panel => .{ .fg = theme.editor_widget.bg, .bg = theme.panel.bg }, diff --git a/src/tui/tui.zig b/src/tui/tui.zig index 6a90cb8..63219a2 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -2225,6 +2225,7 @@ pub fn get_widget_style(widget_type: WidgetType) *const WidgetStyle { return switch (widget_type) { .none => WidgetStyle.from_tag(config_.widget_style), .palette => WidgetStyle.from_tag(config_.palette_style), + .dropdown => WidgetStyle.from_tag(config_.dropdown_style), .panel => WidgetStyle.from_tag(config_.panel_style), .home => WidgetStyle.from_tag(config_.home_style), .pane_left => WidgetStyle.from_tag(config_.pane_left_style), @@ -2252,6 +2253,7 @@ fn widget_type_config_variable(widget_type: WidgetType) *ConfigWidgetStyle { return switch (widget_type) { .none => &config_.widget_style, .palette => &config_.palette_style, + .dropdown => &config_.dropdown_style, .panel => &config_.panel_style, .home => &config_.home_style, .pane_left => &config_.pane_left_style,