feat: add panel border to logview

closes #373
This commit is contained in:
CJ van den Berg 2025-12-11 19:00:24 +01:00
parent c718924698
commit 94d75a230b
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -10,6 +10,7 @@ const cbor = @import("cbor");
const Plane = @import("renderer").Plane; const Plane = @import("renderer").Plane;
const Widget = @import("Widget.zig"); const Widget = @import("Widget.zig");
const WidgetList = @import("WidgetList.zig");
const MessageFilter = @import("MessageFilter.zig"); const MessageFilter = @import("MessageFilter.zig");
const escape = @import("std").ascii.hexEscape; const escape = @import("std").ascii.hexEscape;
@ -22,6 +23,7 @@ var persistent_buffer: ?Buffer = null;
var last_count: u64 = 0; var last_count: u64 = 0;
const Self = @This(); const Self = @This();
const widget_type: Widget.Type = .panel;
const Entry = struct { const Entry = struct {
src: []u8, src: []u8,
@ -40,8 +42,11 @@ const Level = enum {
pub fn create(allocator: Allocator, parent: Plane) !Widget { pub fn create(allocator: Allocator, parent: Plane) !Widget {
const self = try allocator.create(Self); const self = try allocator.create(Self);
errdefer allocator.destroy(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) }; 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 { pub fn deinit(self: *Self, allocator: Allocator) void {