Add generic list panel primitive

This commit is contained in:
slhx agent
2026-06-21 02:45:16 +02:00
parent ffa51e17c7
commit c0a4d1c9bb
6 changed files with 498 additions and 23 deletions
+32
View File
@@ -151,6 +151,10 @@ pub const Session = struct {
try self.panels.open(title);
}
pub fn openListPanel(self: *Session, title: []const u8, items: []const []const u8) !void {
try self.panels.openList(title, items);
}
pub fn closePanel(self: *Session) !void {
try self.panels.closeActive();
}
@@ -163,10 +167,38 @@ pub const Session = struct {
try self.panels.previous();
}
pub fn filterListPanel(self: *Session, filter: []const u8) !void {
try self.panels.filterList(filter);
}
pub fn listPanelDown(self: *Session) !void {
try self.panels.listDown();
}
pub fn listPanelUp(self: *Session) !void {
try self.panels.listUp();
}
pub fn selectListPanel(self: *Session) ![]const u8 {
return self.panels.selectList();
}
pub fn cancelListPanel(self: *Session) !void {
try self.panels.cancelList();
}
pub fn panelPathAlloc(self: *const Session, allocator: std.mem.Allocator) ![]u8 {
return self.panels.pathAlloc(allocator);
}
pub fn panelSummaryAlloc(self: *const Session, allocator: std.mem.Allocator) ![]u8 {
return self.panels.summaryAlloc(allocator);
}
pub fn activeListRowsAlloc(self: *const Session, allocator: std.mem.Allocator, max_rows: usize) ![][]u8 {
return self.panels.activeListRowsAlloc(allocator, max_rows);
}
pub fn snapshot(self: *const Session) !Snapshot {
const panel_state = self.panels.state();
if (self.buffer) |*buffer| {