mod: cleanup TODO and outdated comments
This commit is contained in:
@@ -27,7 +27,6 @@ const QuitText = struct {
|
|||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
errdefer |err| log.err("Application Error: {any}", .{err});
|
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;
|
var gpa: std.heap.DebugAllocator(.{}) = .init;
|
||||||
defer if (gpa.deinit() == .leak) log.err("memory leak", .{});
|
defer if (gpa.deinit() == .leak) log.err("memory leak", .{});
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ const HelloWorldText = packed struct {
|
|||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
errdefer |err| log.err("Application Error: {any}", .{err});
|
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;
|
var gpa: std.heap.DebugAllocator(.{}) = .init;
|
||||||
defer {
|
defer {
|
||||||
const deinit_status = gpa.deinit();
|
const deinit_status = gpa.deinit();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
//! Cell type containing content and formatting for each character in the terminal screen.
|
//! 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 = ' ',
|
cp: u21 = ' ',
|
||||||
style: Style = .{ .emphasis = &.{} },
|
style: Style = .{ .emphasis = &.{} },
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ pub const Color = enum(u8) {
|
|||||||
white,
|
white,
|
||||||
// TODO add further colors as described in https://gist.github.com/ConnerWill/d4b6c776b509add763e17f9f113fd25b # Color / Graphics Mode - 256 Colors
|
// 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 {
|
pub inline fn write(this: Color, writer: *std.Io.Writer, comptime coloring: enum { fg, bg, ul }) !void {
|
||||||
if (this == .default) {
|
if (this == .default) {
|
||||||
switch (coloring) {
|
switch (coloring) {
|
||||||
|
|||||||
@@ -228,11 +228,16 @@ pub fn Scrollable(Model: type, Event: type) type {
|
|||||||
configuration: Configuration,
|
configuration: Configuration,
|
||||||
|
|
||||||
pub const Configuration = packed struct {
|
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,
|
scrollbar: bool,
|
||||||
|
/// Primary color to be used for the scrollbar (and background if enabled)
|
||||||
color: Color = .default,
|
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,
|
show_background: bool = false,
|
||||||
|
/// should the scrollbar be shown for the x-axis (horizontal)
|
||||||
x_axis: bool = false,
|
x_axis: bool = false,
|
||||||
|
/// should the scrollbar be shown for the y-axis (vertical)
|
||||||
y_axis: bool = false,
|
y_axis: bool = false,
|
||||||
|
|
||||||
pub const disabled: @This() = .{ .scrollbar = 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 {
|
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`
|
{ // 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.";
|
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)))) {
|
switch (@typeInfo(@FieldType(Event, @tagName(accept_event)))) {
|
||||||
.void => |_| {},
|
.void => |_| {},
|
||||||
else => @compileError(err_msg),
|
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 event to signify the end of the event loop (rendering should stop afterwards)
|
||||||
quit,
|
quit,
|
||||||
/// Resize event to signify that the application should re-draw to resize
|
/// 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,
|
resize,
|
||||||
/// Error event to notify other containers about a recoverable error
|
/// Error event to notify other containers about a recoverable error
|
||||||
err: struct {
|
err: struct {
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ pub const Key = packed struct {
|
|||||||
return meta.eql(this, other);
|
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
|
/// 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
|
/// 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
|
/// 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);
|
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 {
|
pub fn value(this: Style, writer: *std.Io.Writer, cp: u21) !void {
|
||||||
var buffer: [4]u8 = undefined;
|
var buffer: [4]u8 = undefined;
|
||||||
const bytes = try unicode.utf8Encode(cp, &buffer);
|
const bytes = try unicode.utf8Encode(cp, &buffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user