refactor: zigify imports and correct minor mistakes

This commit is contained in:
2025-05-20 18:23:44 +02:00
parent 50adf32f14
commit aa4adf20f9
26 changed files with 311 additions and 330 deletions

View File

@@ -1,11 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const input = zterm.input;
const App = zterm.App(union(enum) {});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit. Press ctrl+n to launch helix.";
@@ -158,6 +150,7 @@ pub fn main() !void {
if (key.eql(.{ .cp = 'n', .mod = .{ .ctrl = true } })) {
try app.interrupt();
renderer.size = .{}; // reset size, such that next resize will cause a full re-draw!
defer app.start() catch @panic("could not start app event loop");
var child = std.process.Child.init(&.{"hx"}, allocator);
_ = child.spawnAndWait() catch |err| app.postEvent(.{
@@ -188,10 +181,16 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const input = zterm.input;
const App = zterm.App(union(enum) {});

View File

@@ -1,12 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {
click: [:0]const u8,
});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -139,10 +130,17 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {
click: [:0]const u8,
});

View File

@@ -1,12 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {
accept: []u21,
});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -219,10 +210,17 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {
accept: []u21,
});

View File

@@ -1,11 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const input = zterm.input;
const App = zterm.App(union(enum) {});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -190,10 +182,16 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const input = zterm.input;
const App = zterm.App(union(enum) {});

View File

@@ -1,10 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -150,10 +143,15 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});

View File

@@ -1,10 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -106,10 +99,15 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});

View File

@@ -1,10 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -98,10 +91,15 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});

View File

@@ -1,10 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -114,10 +107,15 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});

View File

@@ -1,10 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -97,10 +90,15 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});

View File

@@ -1,10 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -93,10 +86,15 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});

View File

@@ -1,10 +1,3 @@
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});
const log = std.log.scoped(.default);
const QuitText = struct {
const text = "Press ctrl+c to quit.";
@@ -148,10 +141,15 @@ pub fn main() !void {
else => {},
}
try renderer.resize();
container.resize(renderer.size);
container.resize(try renderer.resize());
container.reposition(.{});
try renderer.render(@TypeOf(container), &container);
try renderer.flush();
}
}
const log = std.log.scoped(.default);
const std = @import("std");
const zterm = @import("zterm");
const App = zterm.App(union(enum) {});