diff --git a/examples/demo.zig b/examples/demo.zig index b5414d9..2eda247 100644 --- a/examples/demo.zig +++ b/examples/demo.zig @@ -26,7 +26,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -35,7 +35,7 @@ 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 + // TODO maybe create own allocator as some sort of arena allocator to have consistent memory usage var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer if (gpa.deinit() == .leak) log.err("memory leak", .{}); @@ -47,7 +47,7 @@ pub fn main() !void { var quit_text: QuitText = .{}; - // TODO: what should the demo application do? + // TODO what should the demo application do? // - some sort of chat? -> write messages and have them displayed in a scrollable array at the right hand side? // - on the left some buttons? var box = try App.Container.init(allocator, .{ @@ -127,12 +127,12 @@ pub fn main() !void { continue; } }, - // NOTE: errors could be displayed in another container in case one was received, etc. to provide the user with feedback + // NOTE errors could be displayed in another container in case one was received, etc. to provide the user with feedback .err => |err| log.err("Received {s} with message: {s}", .{ @errorName(err.err), err.msg }), else => {}, } - // NOTE: returned errors should be propagated back to the application + // NOTE returned errors should be propagated back to the application container.handle(event) catch |err| app.postEvent(.{ .err = .{ .err = err, diff --git a/examples/elements/button.zig b/examples/elements/button.zig index a3f820c..b4ce35e 100644 --- a/examples/elements/button.zig +++ b/examples/elements/button.zig @@ -27,7 +27,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -77,7 +77,7 @@ const Clickable = struct { cells[anchor + idx].style.emphasis = &.{.bold}; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } diff --git a/examples/elements/input.zig b/examples/elements/input.zig index cb8ece8..9b0ff01 100644 --- a/examples/elements/input.zig +++ b/examples/elements/input.zig @@ -27,7 +27,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -88,7 +88,7 @@ const InputField = struct { cells[anchor + idx].style.fg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } diff --git a/examples/elements/scrollable.zig b/examples/elements/scrollable.zig index f4872c7..ce3ad18 100644 --- a/examples/elements/scrollable.zig +++ b/examples/elements/scrollable.zig @@ -26,7 +26,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -46,7 +46,7 @@ const HelloWorldText = packed struct { _ = ctx; std.debug.assert(cells.len == @as(usize, size.cols) * @as(usize, size.rows)); - // NOTE: error should only be returned here in case an in-recoverable exception has occurred + // NOTE error should only be returned here in case an in-recoverable exception has occurred const row = size.rows / 2; const col = size.cols / 2 -| (text.len / 2); const anchor = (row * size.cols) + col; @@ -61,7 +61,7 @@ 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 + // TODO maybe create own allocator as some sort of arena allocator to have consistent memory usage var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; defer { const deinit_status = gpa.deinit(); diff --git a/examples/errors.zig b/examples/errors.zig index 118f6b5..6d99c07 100644 --- a/examples/errors.zig +++ b/examples/errors.zig @@ -25,7 +25,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -51,7 +51,7 @@ const InfoText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -88,7 +88,7 @@ const ErrorNotification = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } diff --git a/examples/layouts/grid.zig b/examples/layouts/grid.zig index 198f609..3a24053 100644 --- a/examples/layouts/grid.zig +++ b/examples/layouts/grid.zig @@ -28,7 +28,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -89,12 +89,12 @@ pub fn main() !void { .quit => break, .resize => |size| try renderer.resize(size), .key => |key| if (key.eql(.{ .cp = 'c', .mod = .{ .ctrl = true } })) app.quit(), - // NOTE: errors could be displayed in another container in case one was received, etc. to provide the user with feedback + // NOTE errors could be displayed in another container in case one was received, etc. to provide the user with feedback .err => |err| log.err("Received {s} with message: {s}", .{ @errorName(err.err), err.msg }), else => {}, } - // NOTE: returned errors should be propagated back to the application + // NOTE returned errors should be propagated back to the application container.handle(event) catch |err| app.postEvent(.{ .err = .{ .err = err, diff --git a/examples/layouts/horizontal.zig b/examples/layouts/horizontal.zig index f7e78c8..2fd662a 100644 --- a/examples/layouts/horizontal.zig +++ b/examples/layouts/horizontal.zig @@ -28,7 +28,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -81,12 +81,12 @@ pub fn main() !void { .quit => break, .resize => |size| try renderer.resize(size), .key => |key| if (key.eql(.{ .cp = 'c', .mod = .{ .ctrl = true } })) app.quit(), - // NOTE: errors could be displayed in another container in case one was received, etc. to provide the user with feedback + // NOTE errors could be displayed in another container in case one was received, etc. to provide the user with feedback .err => |err| log.err("Received {s} with message: {s}", .{ @errorName(err.err), err.msg }), else => {}, } - // NOTE: returned errors should be propagated back to the application + // NOTE returned errors should be propagated back to the application container.handle(event) catch |err| app.postEvent(.{ .err = .{ .err = err, diff --git a/examples/layouts/mixed.zig b/examples/layouts/mixed.zig index 4f80743..11f9d41 100644 --- a/examples/layouts/mixed.zig +++ b/examples/layouts/mixed.zig @@ -28,7 +28,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -93,12 +93,12 @@ pub fn main() !void { .quit => break, .resize => |size| try renderer.resize(size), .key => |key| if (key.eql(.{ .cp = 'c', .mod = .{ .ctrl = true } })) app.quit(), - // NOTE: errors could be displayed in another container in case one was received, etc. to provide the user with feedback + // NOTE errors could be displayed in another container in case one was received, etc. to provide the user with feedback .err => |err| log.err("Received {s} with message: {s}", .{ @errorName(err.err), err.msg }), else => {}, } - // NOTE: returned errors should be propagated back to the application + // NOTE returned errors should be propagated back to the application container.handle(event) catch |err| app.postEvent(.{ .err = .{ .err = err, diff --git a/examples/layouts/vertical.zig b/examples/layouts/vertical.zig index fa6c4fc..a7e4302 100644 --- a/examples/layouts/vertical.zig +++ b/examples/layouts/vertical.zig @@ -28,7 +28,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } @@ -80,12 +80,12 @@ pub fn main() !void { .quit => break, .resize => |size| try renderer.resize(size), .key => |key| if (key.eql(.{ .cp = 'c', .mod = .{ .ctrl = true } })) app.quit(), - // NOTE: errors could be displayed in another container in case one was received, etc. to provide the user with feedback + // NOTE errors could be displayed in another container in case one was received, etc. to provide the user with feedback .err => |err| log.err("Received {s} with message: {s}", .{ @errorName(err.err), err.msg }), else => {}, } - // NOTE: returned errors should be propagated back to the application + // NOTE returned errors should be propagated back to the application container.handle(event) catch |err| app.postEvent(.{ .err = .{ .err = err, diff --git a/examples/styles/palette.zig b/examples/styles/palette.zig index 6358144..c9936b5 100644 --- a/examples/styles/palette.zig +++ b/examples/styles/palette.zig @@ -25,7 +25,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } diff --git a/examples/styles/text.zig b/examples/styles/text.zig index 0ade9c5..dd2850c 100644 --- a/examples/styles/text.zig +++ b/examples/styles/text.zig @@ -25,7 +25,7 @@ const QuitText = struct { cells[anchor + idx].style.bg = .black; cells[anchor + idx].cp = cp; - // NOTE: do not write over the contents of this `Container`'s `Size` + // NOTE do not write over the contents of this `Container`'s `Size` if (anchor + idx == cells.len - 1) break; } } diff --git a/src/app.zig b/src/app.zig index 857f0f3..6b782ac 100644 --- a/src/app.zig +++ b/src/app.zig @@ -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 => {}, } diff --git a/src/cell.zig b/src/cell.zig index 54faa61..018b5e8 100644 --- a/src/cell.zig +++ b/src/cell.zig @@ -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 { diff --git a/src/color.zig b/src/color.zig index fc9ae5e..f75e704 100644 --- a/src/color.zig +++ b/src/color.zig @@ -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) { diff --git a/src/container.zig b/src/container.zig index da33bab..8d672dc 100644 --- a/src/container.zig +++ b/src/container.zig @@ -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; diff --git a/src/ctlseqs.zig b/src/ctlseqs.zig index 97f5e95..a8c6e05 100644 --- a/src/ctlseqs.zig +++ b/src/ctlseqs.zig @@ -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"; diff --git a/src/element.zig b/src/element.zig index b373d6f..c683de7 100644 --- a/src/element.zig +++ b/src/element.zig @@ -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"); diff --git a/src/event.zig b/src/event.zig index a0126e9..e81fd59 100644 --- a/src/event.zig +++ b/src/event.zig @@ -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, }; diff --git a/src/render.zig b/src/render.zig index 6558b6f..fa139cc 100644 --- a/src/render.zig +++ b/src/render.zig @@ -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; diff --git a/src/style.zig b/src/style.zig index 21ac0a7..9d7fa37 100644 --- a/src/style.zig +++ b/src/style.zig @@ -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? diff --git a/src/testing.zig b/src/testing.zig index dfe4d74..dd9fa9d 100644 --- a/src/testing.zig +++ b/src/testing.zig @@ -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?