3 Commits

Author SHA1 Message Date
361623d0f1 doc: remove warning about required zig version
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 54s
2026-01-17 12:31:23 +01:00
6bf4c98d44 mod(ci): adapt to use zig latest release version
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m13s
2026-01-17 12:28:29 +01:00
bfdaf82626 mod: bump zterm dependency with required code adaptations
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m16s
2026-01-17 12:26:36 +01:00
6 changed files with 19 additions and 36 deletions

View File

@@ -15,9 +15,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup zig installation
uses: mlugg/setup-zig@v2
uses: https://codeberg.org/mlugg/setup-zig@v2
with:
version: master
version: latest
- name: Run tests
run: zig build --release=fast
- name: Release build artifacts

View File

@@ -14,9 +14,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup zig installation
uses: mlugg/setup-zig@v2
uses: https://codeberg.org/mlugg/setup-zig@v2
with:
version: master
version: latest
- name: Lint check
run: zig fmt --check .
- name: Spell checking

View File

@@ -4,9 +4,6 @@ This is my terminal based website. It is served as a tui application via ssh and
It contains information about me and my projects as well as blog entries about something I feel like writing something about.
> [!caution]
> Only builds using the zig master version are tested to work.
## zterm
This tui application also serves as an example implementation of the [zterm](https://gitea.yves-biener.de/yves-biener/zterm) library.

View File

@@ -6,12 +6,12 @@
.minimum_zig_version = "0.16.0-dev.463+f624191f9",
.dependencies = .{
.zterm = .{
.url = "git+https://gitea.yves-biener.de/yves-biener/zterm#ad32e46bc9fd6d1d9b7a3615979a3b80877c9300",
.hash = "zterm-0.3.0-1xmmEO8PHABP4tE6BnEZllJTh6Hpza_5C9wS8s2vjwou",
.url = "git+https://gitea.yves-biener.de/yves-biener/zterm#4874252e8c3a5d645ac2c37bbfd0e669964912fc",
.hash = "zterm-0.3.0-1xmmEH82HABfsn5imAK8lw93LevIaqNV10g6xfkNj_OT",
},
.zlog = .{
.url = "git+https://gitea.yves-biener.de/yves-biener/zlog#f43034cea9a0863e618c3d0a43706ce38c8791cf",
.hash = "zlog-0.16.0-6JSlRx1JAADasbK5FS6Qaf0Iq1SCQaH5VZRxT2SRE2xs",
.url = "git+https://gitea.yves-biener.de/yves-biener/zlog#40ced30a574118cd76202c07dc4b2291c3321d3a",
.hash = "zlog-0.16.0-6JSlR-BIAAAZ4fSbV54zbZZ9hnZSeOPnnFtiVjmIy3ID",
},
},
.paths = .{

View File

@@ -21,25 +21,13 @@ pub fn Content(App: type) type {
};
}
fn minSize(ctx: *anyopaque, size: zterm.Point) zterm.Point {
fn minSize(ctx: *anyopaque, _: *const App.Model, size: zterm.Point) zterm.Point {
const this: *const @This() = @ptrCast(@alignCast(ctx));
const text = this.document.content;
var index: usize = 0;
var new_size: zterm.Point = .{ .x = size.x };
_ = this;
//const text = this.document.content;
//var index: usize = 0;
const new_size: zterm.Point = .{ .x = size.x };
for (0..text.len) |_| rows: {
for (0..size.x - 1) |_| { // assume that there is one cell reserved for the scrollbar
if (index == text.len) break :rows;
const cp = text[index];
index += 1;
switch (cp) {
'\n' => break,
else => {},
}
}
new_size.y += 1;
}
return new_size;
}
@@ -52,7 +40,7 @@ pub fn Content(App: type) type {
model.page = .about;
model.document.deinit(this.allocator);
model.document = .init(try std.fs.cwd().readFileAlloc("./doc/about.md", this.allocator, .unlimited));
model.document = .init(try std.fs.cwd().readFileAlloc(this.allocator, "./doc/about.md", std.math.maxInt(usize)));
this.document = &model.document;
},
.blog => |path| {
@@ -64,7 +52,7 @@ pub fn Content(App: type) type {
model.page = .{ .blog = null };
}
model.document = .init(try std.fs.cwd().readFileAlloc(if (path) |p| p else "./doc/blog.md", this.allocator, .unlimited));
model.document = .init(try std.fs.cwd().readFileAlloc(this.allocator, if (path) |p| p else "./doc/blog.md", std.math.maxInt(usize)));
model.page = .{ .blog = path };
this.document = &model.document;

View File

@@ -20,9 +20,9 @@ pub fn main() !void {
// skip own executable name
_ = arg_it.skip();
var app: App = .init(.{
var app: App = .init(.{}, .{
.page = .about,
.document = .init(try std.fs.cwd().readFileAlloc("./doc/about.md", allocator, .unlimited)),
.document = .init(try std.fs.cwd().readFileAlloc(allocator, "./doc/about.md", std.math.maxInt(usize))),
});
defer app.model.deinit(allocator);
@@ -38,7 +38,6 @@ pub fn main() !void {
}, .{});
defer container.deinit();
var content_container: App.Container = undefined;
defer content_container.deinit();
// header with navigation buttons and content's title
{
@@ -162,9 +161,8 @@ pub fn main() !void {
}
}
container.resize(try renderer.resize());
container.reposition(.{});
container.resize(&app.model, try renderer.resize());
container.reposition(&app.model, .{});
try renderer.render(@TypeOf(container), &container, App.Model, &app.model);
try renderer.flush();
}