mod: cleanup TODO and outdated comments
This commit is contained in:
@@ -27,7 +27,6 @@ const QuitText = struct {
|
||||
pub fn main() !void {
|
||||
errdefer |err| log.err("Application Error: {any}", .{err});
|
||||
|
||||
// TODO maybe create own allocator as some sort of arena allocator to have consistent memory usage
|
||||
var gpa: std.heap.DebugAllocator(.{}) = .init;
|
||||
defer if (gpa.deinit() == .leak) log.err("memory leak", .{});
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ const HelloWorldText = packed struct {
|
||||
pub fn main() !void {
|
||||
errdefer |err| log.err("Application Error: {any}", .{err});
|
||||
|
||||
// TODO maybe create own allocator as some sort of arena allocator to have consistent memory usage
|
||||
var gpa: std.heap.DebugAllocator(.{}) = .init;
|
||||
defer {
|
||||
const deinit_status = gpa.deinit();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//! Cell type containing content and formatting for each character in the terminal screen.
|
||||
|
||||
// TODO embrace `zg` dependency more due to utf-8 encoding
|
||||
cp: u21 = ' ',
|
||||
style: Style = .{ .emphasis = &.{} },
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ pub const Color = enum(u8) {
|
||||
white,
|
||||
// TODO add further colors as described in https://gist.github.com/ConnerWill/d4b6c776b509add763e17f9f113fd25b # Color / Graphics Mode - 256 Colors
|
||||
|
||||
// TODO might be useful to use the std.ascii stuff!
|
||||
|
||||
pub inline fn write(this: Color, writer: *std.Io.Writer, comptime coloring: enum { fg, bg, ul }) !void {
|
||||
if (this == .default) {
|
||||
switch (coloring) {
|
||||
|
||||
@@ -228,11 +228,16 @@ pub fn Scrollable(Model: type, Event: type) type {
|
||||
configuration: Configuration,
|
||||
|
||||
pub const Configuration = packed struct {
|
||||
// TODO the scrollbar bool and the color should be in their own struct using `enabled` and `color` inside of the struct to be more consistent with other `Configuration` structs
|
||||
scrollbar: bool,
|
||||
/// Primary color to be used for the scrollbar (and background if enabled)
|
||||
color: Color = .default,
|
||||
/// With a backgroud the `color` rendered with emphasis `.dim`
|
||||
/// will be used to highlight the scrollbar from the background;
|
||||
/// otherwise nothing is shown for the background
|
||||
show_background: bool = false,
|
||||
/// should the scrollbar be shown for the x-axis (horizontal)
|
||||
x_axis: bool = false,
|
||||
/// should the scrollbar be shown for the y-axis (vertical)
|
||||
y_axis: bool = false,
|
||||
|
||||
pub const disabled: @This() = .{ .scrollbar = false };
|
||||
@@ -671,6 +676,7 @@ pub fn Button(Model: type, Event: type, Queue: type) fn (meta.FieldEnum(Event))
|
||||
pub fn button_fn(accept_event: meta.FieldEnum(Event)) type {
|
||||
{ // check for type correctness and the associated type to use for the passed `accept_event`
|
||||
const err_msg = "Unexpected type for the associated input completion event to trigger. Only `void` is allowed.";
|
||||
// TODO supported nested tagged unions to be also be used for triggering if the enum is then still of `void`type!
|
||||
switch (@typeInfo(@FieldType(Event, @tagName(accept_event)))) {
|
||||
.void => |_| {},
|
||||
else => @compileError(err_msg),
|
||||
|
||||
@@ -9,6 +9,9 @@ pub const SystemEvent = union(enum) {
|
||||
/// Quit event to signify the end of the event loop (rendering should stop afterwards)
|
||||
quit,
|
||||
/// Resize event to signify that the application should re-draw to resize
|
||||
///
|
||||
/// Usually no `Container` nor `Element` should act on that event, as it
|
||||
/// only serves for event based loops to force a re-draw with a new `Event`.
|
||||
resize,
|
||||
/// Error event to notify other containers about a recoverable error
|
||||
err: struct {
|
||||
|
||||
@@ -65,8 +65,6 @@ pub const Key = packed struct {
|
||||
return meta.eql(this, other);
|
||||
}
|
||||
|
||||
// TODO might be useful to use the std.ascii stuff!
|
||||
|
||||
/// Determine if the `Key` is an ascii character that can be printed to
|
||||
/// the screen. This means that the code point of the `Key` is an ascii
|
||||
/// character between 32 - 255 (with the exception of 127 = Delete) and no
|
||||
|
||||
@@ -40,8 +40,6 @@ pub fn eql(this: Style, other: Style) bool {
|
||||
return meta.eql(this, other);
|
||||
}
|
||||
|
||||
// TODO might be useful to use the std.ascii stuff!
|
||||
|
||||
pub fn value(this: Style, writer: *std.Io.Writer, cp: u21) !void {
|
||||
var buffer: [4]u8 = undefined;
|
||||
const bytes = try unicode.utf8Encode(cp, &buffer);
|
||||
|
||||
Reference in New Issue
Block a user