diff --git a/TODO.md b/TODO.md index be8138f90..94361e92c 100644 --- a/TODO.md +++ b/TODO.md @@ -5,13 +5,14 @@ Bugs: Performance: * libuv allocates on every read, we should use a read buffer pool -* update cells should only update the changed cells * for scrollback, investigate using segmented list for sufficiently large scrollback scenarios. * scrollback: dynamic growth rather than prealloc * reflow: text reflow is really poorly implemented right now specifically for shrinking columns. Look into this. This may require changing the screen data structure. +* Screen cell structure should be rethought to use some data oriented design, + also bring it closer to GPU cells, perhaps. Correctness: @@ -23,6 +24,7 @@ Correctness: - need fallback glyphs if they're not supported - can effect a crash using `vttest` menu `3 10` since it tries to parse ASCII as UTF-8. +* Graphemes need to be detected and treated as a single unit Improvements: diff --git a/src/terminal/Screen.zig b/src/terminal/Screen.zig index 73466b685..1a8890705 100644 --- a/src/terminal/Screen.zig +++ b/src/terminal/Screen.zig @@ -92,9 +92,13 @@ pub const Cell = struct { test { // We use this test to ensure we always get the right size of the attrs const cell: Cell = .{ .char = 0 }; + _ = @bitCast(u8, cell.attrs); try std.testing.expectEqual(1, @sizeOf(@TypeOf(cell.attrs))); + } - log.warn("CELL={}", .{@sizeOf(Cell)}); + test { + //log.warn("CELL={}", .{@sizeOf(Cell)}); + try std.testing.expectEqual(16, @sizeOf(Cell)); } }; diff --git a/src/terminal/color.zig b/src/terminal/color.zig index 6fa3cc7a8..c8c8a37d4 100644 --- a/src/terminal/color.zig +++ b/src/terminal/color.zig @@ -94,10 +94,14 @@ pub const Name = enum(u8) { }; /// RGB -pub const RGB = struct { +pub const RGB = packed struct { r: u8, g: u8, b: u8, + + test { + try std.testing.expectEqual(@as(usize, 3), @sizeOf(RGB)); + } }; test "palette: default" {