refactor: add info_box widget style

This commit is contained in:
CJ van den Berg 2026-02-05 15:59:39 +01:00
parent 69f5448f03
commit 6280d7d0b4
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 12 additions and 0 deletions

View file

@ -74,6 +74,7 @@ pane_left_style: WidgetStyle = .bar_right,
pane_right_style: WidgetStyle = .bar_left, pane_right_style: WidgetStyle = .bar_left,
pane_style: PaneStyle = .panel, pane_style: PaneStyle = .panel,
hint_window_style: WidgetStyle = .thick_boxed, hint_window_style: WidgetStyle = .thick_boxed,
info_box_style: WidgetStyle = .bar_left,
centered_view: bool = false, centered_view: bool = false,
centered_view_width: usize = 145, centered_view_width: usize = 145,
@ -119,6 +120,7 @@ pub const WidgetType = enum {
pane_left, pane_left,
pane_right, pane_right,
hint_window, hint_window,
info_box,
dropdown, dropdown,
}; };

View file

@ -169,6 +169,7 @@ pub fn theme_style_from_type(style_type: WidgetType, theme: *const Theme) Theme.
.editor => .{ .fg = theme.editor_widget.bg, .bg = theme.editor.bg }, .editor => .{ .fg = theme.editor_widget.bg, .bg = theme.editor.bg },
}, },
.hint_window => .{ .fg = theme.editor_widget_border.fg, .bg = theme.editor_widget.bg }, .hint_window => .{ .fg = theme.editor_widget_border.fg, .bg = theme.editor_widget.bg },
.info_box => .{ .fg = theme.editor_widget_border.fg, .bg = theme.editor_widget.bg },
}; };
} }

View file

@ -1663,6 +1663,13 @@ const cmds = struct {
} }
pub const dropdown_next_widget_style_meta: Meta = .{}; pub const dropdown_next_widget_style_meta: Meta = .{};
pub fn info_box_widget_style(_: *Self, _: Ctx) Result {
set_next_style(.info_box);
need_render(@src());
try save_config();
}
pub const info_box_widget_style_meta: Meta = .{};
pub fn enable_fast_scroll(self: *Self, _: Ctx) Result { pub fn enable_fast_scroll(self: *Self, _: Ctx) Result {
self.fast_scroll_ = true; self.fast_scroll_ = true;
} }
@ -2355,6 +2362,7 @@ pub fn get_widget_style(widget_type: WidgetType) *const WidgetStyle {
.pane_left => WidgetStyle.from_tag(config_.pane_left_style), .pane_left => WidgetStyle.from_tag(config_.pane_left_style),
.pane_right => WidgetStyle.from_tag(config_.pane_right_style), .pane_right => WidgetStyle.from_tag(config_.pane_right_style),
.hint_window => WidgetStyle.from_tag(config_.hint_window_style), .hint_window => WidgetStyle.from_tag(config_.hint_window_style),
.info_box => WidgetStyle.from_tag(config_.info_box_style),
}; };
} }
@ -2383,6 +2391,7 @@ fn widget_type_config_variable(widget_type: WidgetType) *ConfigWidgetStyle {
.pane_left => &config_.pane_left_style, .pane_left => &config_.pane_left_style,
.pane_right => &config_.pane_right_style, .pane_right => &config_.pane_right_style,
.hint_window => &config_.hint_window_style, .hint_window => &config_.hint_window_style,
.info_box => &config_.info_box_style,
}; };
} }