mod(structure): update project structure

Remove examples, add description for design goals in README.md and
apply re-names and naming changes accordingly for the project structure.
Implement a flat hierachry, as the library shall remain pretty simple.
This commit is contained in:
2025-01-30 23:02:34 +01:00
parent 3decc541a9
commit bdbe05c996
41 changed files with 204 additions and 3474 deletions

View File

@@ -1,9 +1,9 @@
const std = @import("std");
pub const Key = @import("terminal/Key.zig");
pub const Size = @import("terminal/Size.zig");
pub const Position = @import("terminal/Position.zig");
pub const Cell = @import("terminal/Cell.zig");
pub const code_point = @import("code_point");
const code_point = @import("code_point");
const Key = @import("key.zig");
const Size = @import("size.zig");
const Cell = @import("cell.zig");
const log = std.log.scoped(.terminal);
@@ -78,13 +78,13 @@ pub fn writer() Writer {
return .{ .context = .{} };
}
pub fn setCursorPosition(pos: Position) !void {
pub fn setCursorPosition(pos: Size.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 {
pub fn getCursorPosition() !Size.Position {
// Needs Raw mode (no wait for \n) to work properly cause
// control sequence will not be written without it.
_ = try std.posix.write(std.posix.STDIN_FILENO, "\x1b[6n");
@@ -227,7 +227,3 @@ fn getReportMode(ps: u8) ReportMode {
else => ReportMode.not_recognized,
};
}
test {
_ = Cell;
}