mod: simplify Container and Element creation with updated zterm behavior
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m9s

This commit is contained in:
2025-11-27 21:23:36 +01:00
parent da9e4c89f3
commit 1485385735
3 changed files with 49 additions and 8 deletions

View File

@@ -1,9 +1,32 @@
//! Model of the `zterm` application.
// TODO planned features:
// - create change sets (i.e. parse diff headers and provide contents) is the multiarray that what I need?
// - create `elements.Change` structs which each point to every change associated to a given file (for each file)
// FIX known issues:
const Model = @This();
content: []const u8,
changes: std.MultiArrayList(Change) = .empty,
render_mode: enum {
side_by_side,
stacked,
} = .stacked,
pub const init: @This() = .{};
// TODO alloc-free parsing? (similar to how I've implemented the parser for `smd`?)
pub const init: Model = .{
.content = &.{},
};
pub const Index = struct {
idx: usize,
len: usize,
};
pub const Change = struct {
file: Index,
diff: Index,
};
const Model = @This();
const std = @import("std");