Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/core/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ if (missingRequired.length > 0) {
process.exit(1)
}

const zigExe = process.env.ZIG ?? "zig"

if (buildNative) {
console.log(`Building native ${isDev ? "dev" : "prod"} binaries...`)

const zigBuild: SpawnSyncReturns<Buffer> = spawnSync(
"zig",
zigExe,
["build", `-Doptimize=${isDev ? "Debug" : "ReleaseFast"}`],
{
cwd: join(rootDir, "src", "zig"),
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/zig/ansi.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ pub const ANSI = struct {

// Direct writing to any writer - the most efficient option
pub fn moveToOutput(writer: anytype, x: u32, y: u32) AnsiError!void {
std.fmt.format(writer, "\x1b[{d};{d}H", .{ y, x }) catch return AnsiError.WriteFailed;
writer.print("\x1b[{d};{d}H", .{ y, x }) catch return AnsiError.WriteFailed;
}

pub fn fgColorOutput(writer: anytype, r: u8, g: u8, b: u8) AnsiError!void {
std.fmt.format(writer, "\x1b[38;2;{d};{d};{d}m", .{ r, g, b }) catch return AnsiError.WriteFailed;
writer.print("\x1b[38;2;{d};{d};{d}m", .{ r, g, b }) catch return AnsiError.WriteFailed;
}

pub fn bgColorOutput(writer: anytype, r: u8, g: u8, b: u8) AnsiError!void {
std.fmt.format(writer, "\x1b[48;2;{d};{d};{d}m", .{ r, g, b }) catch return AnsiError.WriteFailed;
writer.print("\x1b[48;2;{d};{d};{d}m", .{ r, g, b }) catch return AnsiError.WriteFailed;
}

// Text attribute constants
Expand All @@ -49,7 +49,7 @@ pub const ANSI = struct {
pub const cursorUnderlineBlink = "\x1b[3 q";

pub fn cursorColorOutputWriter(writer: anytype, r: u8, g: u8, b: u8) AnsiError!void {
std.fmt.format(writer, "\x1b]12;#{x:0>2}{x:0>2}{x:0>2}\x07", .{ r, g, b }) catch return AnsiError.WriteFailed;
writer.print("\x1b]12;#{x:0>2}{x:0>2}{x:0>2}\x07", .{ r, g, b }) catch return AnsiError.WriteFailed;
}

pub const resetCursorColor = "\x1b]12;default\x07";
Expand All @@ -73,7 +73,7 @@ pub const ANSI = struct {
// This approach is more compatible across different terminals
var i: u32 = height;
while (i > 0) : (i -= 1) {
std.fmt.format(writer, "\x1b[{d};1H\x1b[2K", .{i}) catch return AnsiError.WriteFailed;
writer.print("\x1b[{d};1H\x1b[2K", .{i}) catch return AnsiError.WriteFailed;
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/zig/buffer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pub const OptimizedBuffer = struct {
while (utf8_it.nextCodepoint()) |codepoint| : (i += 1) {
const charX = x + i;
if (charX >= self.width) break;

// Use provided background or get existing background
var bgColor: RGBA = undefined;
if (bg) |b| {
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/zig/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ const SupportedZigVersion = struct {
};

const SUPPORTED_ZIG_VERSIONS = [_]SupportedZigVersion{
.{ .major = 0, .minor = 14, .patch = 0 },
.{ .major = 0, .minor = 14, .patch = 1 },
// .{ .major = 0, .minor = 15, .patch = 0 },
.{ .major = 0, .minor = 15, .patch = 1 },
};

const SupportedTarget = struct {
Expand Down
Loading