From 4234c9ad0c05679c52cc6bf10ffa898ff23db078 Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Tue, 25 Feb 2025 16:55:11 +0100 Subject: [PATCH] rem(element): template `Element` moved into wiki documentation --- src/element.zig | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/src/element.zig b/src/element.zig index 0cc992b..a299b2d 100644 --- a/src/element.zig +++ b/src/element.zig @@ -46,39 +46,6 @@ pub fn Element(Event: type) type { }; } -/// This is an empty template implementation for an Element type which `zterm` may provide. -/// -/// TODO: Should elements need to be composible with each other, such that they may build complexer outputs? -/// - the goal would rather be to have re-usable parts of handlers and/or content functions which serve similar functionalities. -/// - composible through empty `Container`'s? -> make sense for the `Scrollable` `Element` -pub fn Template(Event: type) type { - return packed struct { - pub fn element(this: *@This()) Element(Event) { - return .{ - .ptr = this, - .vtable = &.{ - .handle = handle, - .content = content, - }, - }; - } - - fn handle(ctx: *anyopaque, event: Event) !void { - const this: *@This() = @ptrCast(@alignCast(ctx)); - _ = this; - switch (event) { - else => {}, - } - } - - fn content(ctx: *anyopaque, cells: []Cell, size: Size) !void { - const this: *@This() = @ptrCast(@alignCast(ctx)); - std.debug.assert(cells.len == @as(usize, size.cols) * @as(usize, size.rows)); - _ = this; - } - }; -} - pub fn Scrollable(Event: type) type { return struct { /// `Size` of the actual contents where the anchor and the size is