From dc3b4f8c16e2bc0d0e7ecc3cc25f52e36f50244f Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 11 Dec 2025 18:46:08 +0100 Subject: [PATCH 1/8] refactor: add panel_next_widget_style command --- src/keybind/builtin/flow.json | 2 ++ src/tui/tui.zig | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/keybind/builtin/flow.json b/src/keybind/builtin/flow.json index c15cdb3..6a0af6b 100644 --- a/src/keybind/builtin/flow.json +++ b/src/keybind/builtin/flow.json @@ -44,6 +44,7 @@ ["f10", "theme_next"], ["f11", "toggle_panel"], ["alt+f11", "toggle_color_scheme"], + ["alt+f9", "panel_next_widget_style"], ["shift+alt+f9", "hint_window_next_widget_style"], ["alt+!", "run_task"], ["ctrl+tab", "next_tab"], @@ -527,6 +528,7 @@ "press": [ ["ctrl+?", "toggle_keybind_hints"], ["ctrl+alt+?", "scroll_keybind_hints"], + ["alt+f9", "panel_next_widget_style"], ["ctrl+q", "quit"], ["ctrl+v", "system_paste"], ["ctrl+u", "mini_mode_reset"], diff --git a/src/tui/tui.zig b/src/tui/tui.zig index 60c75c2..761c616 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -1552,6 +1552,13 @@ const cmds = struct { } pub const shrink_centered_view_meta: Meta = .{ .description = "Shrink centered view" }; + pub fn panel_next_widget_style(_: *Self, _: Ctx) Result { + set_next_style(.panel); + need_render(); + try save_config(); + } + pub const panel_next_widget_style_meta: Meta = .{}; + pub fn hint_window_next_widget_style(_: *Self, _: Ctx) Result { set_next_style(.hint_window); need_render(); From b62a1e906f1bc8e29bd6bb4695f9d1ab39c7bcb4 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 11 Dec 2025 18:46:35 +0100 Subject: [PATCH 2/8] fix: resize on widget style changes --- src/tui/tui.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tui/tui.zig b/src/tui/tui.zig index 761c616..3f92333 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -2219,6 +2219,7 @@ pub fn set_next_style(widget_type: WidgetType) void { ref.* = next_widget_style(ref.*); const self = current(); self.logger.print("{t} style {t}", .{ widget_type, ref.* }); + resize(); } fn next_widget_style(tag: ConfigWidgetStyle) ConfigWidgetStyle { From f87a9cfb6d72a23ab525aabd7f4058003f4a682b Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 11 Dec 2025 18:47:01 +0100 Subject: [PATCH 3/8] fix: find panels even if the panel widget is not the top widget --- src/tui/mainview.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tui/mainview.zig b/src/tui/mainview.zig index 190c92a..b3424bf 100644 --- a/src/tui/mainview.zig +++ b/src/tui/mainview.zig @@ -273,7 +273,7 @@ fn bottom_bar_primary_drag(self: *Self, y: usize) tp.result { fn toggle_panel_view(self: *Self, view: anytype, mode: enum { toggle, enable, disable }) !void { if (self.panels) |panels| { - if (panels.get(@typeName(view))) |w| { + if (self.get_panel(@typeName(view))) |w| { if (mode != .enable) { panels.remove(w.*); if (panels.empty()) { @@ -294,6 +294,14 @@ fn toggle_panel_view(self: *Self, view: anytype, mode: enum { toggle, enable, di tui.resize(); } +fn get_panel(self: *Self, name_: []const u8) ?*Widget { + if (self.panels) |panels| + for (panels.widgets.items) |*w| + if (w.widget.get(name_)) |_| + return &w.widget; + return null; +} + fn get_panel_view(self: *Self, comptime view: type) ?*view { return if (self.panels) |panels| if (panels.get(@typeName(view))) |w| w.dynamic_cast(view) else null else null; } From 15fd33807410c2b91a61b40793d681b536a4476c Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 11 Dec 2025 18:59:32 +0100 Subject: [PATCH 4/8] refactor: add panel border to info_view --- src/tui/info_view.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tui/info_view.zig b/src/tui/info_view.zig index 86c65e2..7dee8b2 100644 --- a/src/tui/info_view.zig +++ b/src/tui/info_view.zig @@ -2,6 +2,7 @@ const std = @import("std"); const Allocator = @import("std").mem.Allocator; const Plane = @import("renderer").Plane; const Widget = @import("Widget.zig"); +const WidgetList = @import("WidgetList.zig"); pub const name = @typeName(Self); @@ -13,15 +14,20 @@ plane: Plane, view_rows: usize = 0, lines: std.ArrayList([]const u8), +const widget_type: Widget.Type = .panel; + pub fn create(allocator: Allocator, parent: Plane) !Widget { const self = try allocator.create(Self); errdefer allocator.destroy(self); + const container = try WidgetList.createHStyled(allocator, parent, "panel_frame", .dynamic, widget_type); self.* = .{ .allocator = allocator, .plane = try Plane.init(&(Widget.Box{}).opts(name), parent), .lines = .empty, }; - return Widget.to(self); + container.ctx = self; + try container.add(Widget.to(self)); + return container.widget(); } pub fn deinit(self: *Self, allocator: Allocator) void { From 950c5af01d105bbb9caebd5c4e81b9365c503c00 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 11 Dec 2025 19:00:02 +0100 Subject: [PATCH 5/8] refactor: add panel border to inputview --- src/tui/inputview.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tui/inputview.zig b/src/tui/inputview.zig index 80578c4..d6d87c5 100644 --- a/src/tui/inputview.zig +++ b/src/tui/inputview.zig @@ -13,6 +13,7 @@ const input = @import("input"); const tui = @import("tui.zig"); const Widget = @import("Widget.zig"); +const WidgetList = @import("WidgetList.zig"); pub const name = "inputview"; @@ -23,6 +24,7 @@ last_count: u64 = 0, buffer: Buffer, const Self = @This(); +const widget_type: Widget.Type = .panel; const Entry = struct { time: i64, @@ -34,6 +36,7 @@ const Buffer = ArrayList(Entry); pub fn create(allocator: Allocator, parent: Plane) !Widget { var n = try Plane.init(&(Widget.Box{}).opts_vscroll(@typeName(Self)), parent); errdefer n.deinit(); + const container = try WidgetList.createHStyled(allocator, parent, "panel_frame", .dynamic, widget_type); const self = try allocator.create(Self); errdefer allocator.destroy(self); self.* = .{ @@ -43,7 +46,9 @@ pub fn create(allocator: Allocator, parent: Plane) !Widget { .buffer = .empty, }; try tui.input_listeners().add(EventHandler.bind(self, listen)); - return Widget.to(self); + container.ctx = self; + try container.add(Widget.to(self)); + return container.widget(); } pub fn deinit(self: *Self, allocator: Allocator) void { From 82257ee4e31fdff0e1ad4c2ea65467a93b1564f1 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 11 Dec 2025 19:00:07 +0100 Subject: [PATCH 6/8] refactor: add panel border to inspector_view --- src/tui/inspector_view.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tui/inspector_view.zig b/src/tui/inspector_view.zig index 5ab77b6..a7c26a0 100644 --- a/src/tui/inspector_view.zig +++ b/src/tui/inspector_view.zig @@ -12,6 +12,7 @@ const EventHandler = @import("EventHandler"); const tui = @import("tui.zig"); const Widget = @import("Widget.zig"); +const WidgetList = @import("WidgetList.zig"); const ed = @import("editor.zig"); pub const name = @typeName(Self); @@ -22,17 +23,21 @@ theme: ?*const Widget.Theme = null, last_node: usize = 0, const Self = @This(); +const widget_type: Widget.Type = .panel; pub fn create(allocator: Allocator, parent: Plane) !Widget { const editor = tui.get_active_editor() orelse return error.NotFound; const self = try allocator.create(Self); errdefer allocator.destroy(self); + const container = try WidgetList.createHStyled(allocator, parent, "panel_frame", .dynamic, widget_type); self.* = .{ .plane = try Plane.init(&(Widget.Box{}).opts_vscroll(name), parent), .editor = editor, }; try editor.handlers.add(EventHandler.bind(self, ed_receive)); - return Widget.to(self); + container.ctx = self; + try container.add(Widget.to(self)); + return container.widget(); } pub fn deinit(self: *Self, allocator: Allocator) void { From c71892469822b434bbc7125e8a3cc2ad901f03a6 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 11 Dec 2025 19:00:15 +0100 Subject: [PATCH 7/8] refactor: add panel border to keybindview --- src/tui/keybindview.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tui/keybindview.zig b/src/tui/keybindview.zig index fe5a875..df8aaea 100644 --- a/src/tui/keybindview.zig +++ b/src/tui/keybindview.zig @@ -13,6 +13,7 @@ const input = @import("input"); const tui = @import("tui.zig"); const Widget = @import("Widget.zig"); +const WidgetList = @import("WidgetList.zig"); const MessageFilter = @import("MessageFilter.zig"); pub const name = "keybindview"; @@ -23,6 +24,7 @@ plane: Plane, buffer: Buffer, const Self = @This(); +const widget_type: Widget.Type = .panel; const Entry = struct { time: i64, @@ -34,6 +36,7 @@ const Buffer = ArrayList(Entry); pub fn create(allocator: Allocator, parent: Plane) !Widget { var n = try Plane.init(&(Widget.Box{}).opts_vscroll(@typeName(Self)), parent); errdefer n.deinit(); + const container = try WidgetList.createHStyled(allocator, parent, "panel_frame", .dynamic, widget_type); const self = try allocator.create(Self); errdefer allocator.destroy(self); self.* = .{ @@ -44,7 +47,9 @@ pub fn create(allocator: Allocator, parent: Plane) !Widget { }; try tui.message_filters().add(MessageFilter.bind(self, keybind_match)); tui.enable_match_events(); - return Widget.to(self); + container.ctx = self; + try container.add(Widget.to(self)); + return container.widget(); } pub fn deinit(self: *Self, allocator: Allocator) void { From 94d75a230bf2c96d7637de25af8fa0d6be4bb52a Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 11 Dec 2025 19:00:24 +0100 Subject: [PATCH 8/8] feat: add panel border to logview closes #373 --- src/tui/logview.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tui/logview.zig b/src/tui/logview.zig index 3dae6d9..92a756a 100644 --- a/src/tui/logview.zig +++ b/src/tui/logview.zig @@ -10,6 +10,7 @@ const cbor = @import("cbor"); const Plane = @import("renderer").Plane; const Widget = @import("Widget.zig"); +const WidgetList = @import("WidgetList.zig"); const MessageFilter = @import("MessageFilter.zig"); const escape = @import("std").ascii.hexEscape; @@ -22,6 +23,7 @@ var persistent_buffer: ?Buffer = null; var last_count: u64 = 0; const Self = @This(); +const widget_type: Widget.Type = .panel; const Entry = struct { src: []u8, @@ -40,8 +42,11 @@ const Level = enum { pub fn create(allocator: Allocator, parent: Plane) !Widget { const self = try allocator.create(Self); errdefer allocator.destroy(self); + const container = try WidgetList.createHStyled(allocator, parent, "panel_frame", .dynamic, widget_type); self.* = .{ .plane = try Plane.init(&(Widget.Box{}).opts(name), parent) }; - return Widget.to(self); + container.ctx = self; + try container.add(Widget.to(self)); + return container.widget(); } pub fn deinit(self: *Self, allocator: Allocator) void {