doc: correct TODO, NOTE and FIX comment statements
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 48s

This commit is contained in:
2025-03-03 21:49:11 +01:00
parent edefc80759
commit 91ac6241f4
21 changed files with 52 additions and 52 deletions

View File

@@ -174,11 +174,11 @@ pub fn App(comptime E: type) type {
// thread to read user inputs
var buf: [256]u8 = undefined;
while (true) {
// FIX: I still think that there is a race condition (I'm just waiting 'long' enough)
// FIX I still think that there is a race condition (I'm just waiting 'long' enough)
this.quit_event.timedWait(20 * std.time.ns_per_ms) catch {
// FIX: in case the queue is full -> the next user input should panic and quit the application? because something seems to clock up the event queue
// FIX in case the queue is full -> the next user input should panic and quit the application? because something seems to clock up the event queue
const read_bytes = try terminal.read(buf[0..]);
// TODO: `break` should not terminate the reading of the user inputs, but instead only the received faulty input!
// TODO `break` should not terminate the reading of the user inputs, but instead only the received faulty input!
// escape key presses
if (buf[0] == 0x1b and read_bytes > 1) {
switch (buf[1]) {
@@ -273,7 +273,7 @@ pub fn App(comptime E: type) type {
};
this.postEvent(.{ .key = key });
},
// TODO: focus usage? should this even be in the default event system?
// TODO focus usage? should this even be in the default event system?
'I' => this.postEvent(.{ .focus = true }),
'O' => this.postEvent(.{ .focus = false }),
'M', 'm' => {
@@ -337,7 +337,7 @@ pub fn App(comptime E: type) type {
const height_char = iter.next() orelse break;
const width_char = iter.next() orelse break;
// TODO: only post the event if the size has changed?
// TODO only post the event if the size has changed?
// because there might be too many resize events (which force a re-draw of the entire screen)
const size: Size = .{
.rows = std.fmt.parseUnsigned(u16, height_char, 10) catch break,
@@ -361,7 +361,7 @@ pub fn App(comptime E: type) type {
else => {},
}
},
// TODO: parse corresponding codes
// TODO parse corresponding codes
// 0x5B => parseCsi(input, &self.buf), // CSI see https://github.com/rockorager/libvaxis/blob/main/src/Parser.zig
else => {},
}

View File

@@ -4,7 +4,7 @@ const Style = @import("style.zig");
pub const Cell = @This();
style: Style = .{ .emphasis = &.{} },
// TODO: embrace `zg` dependency more due to utf-8 encoding
// TODO embrace `zg` dependency more due to utf-8 encoding
cp: u21 = ' ',
pub fn eql(this: Cell, other: Cell) bool {

View File

@@ -18,7 +18,7 @@ pub const Color = enum(u8) {
magenta,
cyan,
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
pub inline fn write(this: Color, writer: anytype, comptime coloring: enum { fg, bg, ul }) !void {
if (this == .default) {

View File

@@ -149,11 +149,11 @@ pub const Border = packed struct {
/// Rectangle configuration struct
pub const Rectangle = packed struct {
/// `Color` to use to fill the `Rectangle` with
/// NOTE: used as background color when rendering! such that it renders the
/// NOTE used as background color when rendering! such that it renders the
/// children accordingly without removing the coloring of the `Rectangle`
fill: Color = .default,
// NOTE: caller owns `Cells` slice and ensures that `cells.len == size.cols * size.rows`
// NOTE caller owns `Cells` slice and ensures that `cells.len == size.cols * size.rows`
pub fn contents(this: @This(), cells: []Cell, size: Size) void {
std.debug.assert(cells.len == @as(usize, size.cols) * @as(usize, size.rows));
@@ -700,7 +700,7 @@ pub fn Container(comptime Event: type) type {
var element_size: Size = undefined;
switch (layout.direction) {
.horizontal => {
// TODO: this should not always be the max size property!
// TODO this should not always be the max size property!
var cols = blk: {
if (element.properties.fixed_size.cols > 0) break :blk element.properties.fixed_size.cols;
break :blk element_cols;

View File

@@ -92,7 +92,7 @@ pub const bg_rgb_legacy = "\x1b[48;2;{d};{d};{d}m";
pub const ul_rgb_legacy = "\x1b[58;2;{d};{d};{d}m";
// Underlines
pub const ul_off = "\x1b[24m"; // NOTE: this could be \x1b[4:0m but is not as widely supported
pub const ul_off = "\x1b[24m"; // NOTE this could be \x1b[4:0m but is not as widely supported
pub const ul_single = "\x1b[4m";
pub const ul_double = "\x1b[4:2m";
pub const ul_curly = "\x1b[4:3m";

View File

@@ -92,12 +92,12 @@ pub fn Scrollable(Event: type) type {
switch (event) {
.resize => |size| {
this.size = size;
// TODO: scrollbar space - depending on configuration and only if necessary?
// TODO scrollbar space - depending on configuration and only if necessary?
this.container_size = size.max(this.min_size);
this.container_size.anchor = size.anchor;
try this.container.handle(.{ .resize = this.container_size });
},
// TODO: other means to scroll except with the mouse? (i.e. Ctrl-u/d, k/j, etc.?)
// TODO other means to scroll except with the mouse? (i.e. Ctrl-u/d, k/j, etc.?)
.mouse => |mouse| switch (mouse.button) {
Mouse.Button.wheel_up => if (this.container_size.rows > this.size.rows) {
this.anchor.row -|= 1;
@@ -164,7 +164,7 @@ pub fn Scrollable(Event: type) type {
for (this.container.elements.items) |child| try render_container(child, container_cells, container_size);
const anchor = (@as(usize, this.anchor.row) * @as(usize, container_size.cols)) + @as(usize, this.anchor.col);
// TODO: render scrollbar according to configuration!
// TODO render scrollbar according to configuration!
for (0..size.rows) |row| {
for (0..size.cols) |col| {
cells[(row * size.cols) + col] = container_cells[anchor + (row * container_size.cols) + col];
@@ -175,8 +175,8 @@ pub fn Scrollable(Event: type) type {
};
}
// TODO: nested scrollable `Container`s?'
// TODO: reaction only for when the event is actually pushed to the corresponding `Container` rendered container
// TODO nested scrollable `Container`s?'
// TODO reaction only for when the event is actually pushed to the corresponding `Container` rendered container
test "scrollable vertical" {
const event = @import("event.zig");

View File

@@ -11,7 +11,7 @@ const Size = @import("size.zig").Size;
/// System events available to every `zterm.App`
pub const SystemEvent = union(enum) {
/// Initialize event, which is send once at the beginning of the event loop and before the first render loop
/// TODO: not sure if this is necessary or if there is an actual usecase for this - for now it will remain
/// TODO not sure if this is necessary or if there is an actual usecase for this - for now it will remain
init,
/// Quit event to signify the end of the event loop (rendering should stop afterwards)
quit,
@@ -28,7 +28,7 @@ pub const SystemEvent = union(enum) {
/// Mouse input event
mouse: Mouse,
/// Focus event for mouse interaction
/// TODO: this should instead be a union with a `Size` to derive which container / element the focus meant for
/// TODO this should instead be a union with a `Size` to derive which container / element the focus meant for
focus: bool,
};

View File

@@ -85,7 +85,7 @@ pub const Buffered = struct {
/// Write *virtual screen* to alternate screen (should be called once and last during each render loop iteration in the main loop).
pub fn flush(this: *@This()) !void {
// TODO: measure timings of rendered frames?
// TODO measure timings of rendered frames?
const writer = terminal.writer();
const s = this.screen;
const vs = this.virtual_screen;

View File

@@ -56,7 +56,7 @@ pub fn value(this: Style, writer: anytype, cp: u21) !void {
try std.fmt.format(writer, ";", .{});
try this.bg.write(writer, .bg);
// underline
// FIX: assert that if the underline property is set that the ul style and the attribute for underlining is available
// FIX assert that if the underline property is set that the ul style and the attribute for underlining is available
try std.fmt.format(writer, ";", .{});
try this.ul.write(writer, .ul);
// append styles (aka attributes like bold, italic, strikethrough, etc.)
@@ -67,6 +67,6 @@ pub fn value(this: Style, writer: anytype, cp: u21) !void {
try std.fmt.format(writer, "\x1b[0m", .{});
}
// TODO: implement helper functions for terminal capabilities:
// TODO implement helper functions for terminal capabilities:
// - links / url display (osc 8)
// - show / hide cursor?

View File

@@ -8,7 +8,7 @@ const DisplayWidth = @import("DisplayWidth");
const Position = @import("size.zig").Position;
const Size = @import("size.zig").Size;
// TODO: how would I describe the expected screens?
// TODO how would I describe the expected screens?
// - including styling?
// - compare generated strings instead? -> how would this be generated for the user?