feat(tui): show screen dimentions on resize

This commit is contained in:
CJ van den Berg 2025-01-20 20:30:24 +01:00
parent 4842002136
commit 142f6e51ae
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -311,6 +311,8 @@ fn receive_safe(self: *Self, from: tp.pid_ref, m: tp.message) !void {
if (try m.match(.{"resize"})) {
self.resize();
const box = self.screen();
message("{d}x{d}", .{ box.w, box.h });
return;
}
@ -1174,3 +1176,8 @@ pub fn is_cursor_beam(self: *Self) bool {
else => false,
};
}
pub fn message(comptime fmt: anytype, args: anytype) void {
var buf: [256]u8 = undefined;
tp.self_pid().send(.{ "message", std.fmt.bufPrint(&buf, fmt, args) catch @panic("too large") }) catch {};
}