mod: replace Layout.content with Layout.render
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 30s

The App.Renderer is used for the new `Layout.render` method. Each layout
renders itself now with corresponding renderers which might only update
parts of the screen, etc.
This commit is contained in:
2024-11-10 14:34:28 +01:00
parent b32556720e
commit b314ff7813
12 changed files with 112 additions and 92 deletions

View File

@@ -62,6 +62,12 @@ pub fn write(buf: []const u8) !usize {
return try std.posix.write(std.posix.STDIN_FILENO, buf);
}
pub fn setCursorPosition(pos: Position) !void {
var buf: [64]u8 = undefined;
const value = try std.fmt.bufPrint(&buf, "\x1b[{d};{d}H", .{ pos.row, pos.col });
_ = try std.posix.write(std.posix.STDIN_FILENO, value);
}
pub fn getCursorPosition() !Position {
// Needs Raw mode (no wait for \n) to work properly cause
// control sequence will not be written without it.