Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
check:
uses: fizzyedit/plugin-build-action/.github/workflows/check.yml@v7
with:
zig-version: "0.16.0"
zig-version: "0.17.0"
# secrets:
# build_env: ${{ secrets.MY_BUILD_ENV }} # as in release.yml, if the build needs one
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
permissions:
contents: write
with:
zig-version: "0.16.0"
zig-version: "0.17.0"
2 changes: 1 addition & 1 deletion .github/workflows/sdk-repin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
with:
sdk-version: ${{ github.event.client_payload.version || inputs.sdk-version || '' }}
force: ${{ inputs.force == true }}
zig-version: "0.16.0"
zig-version: "0.17.0"
11 changes: 11 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ pub fn build(b: *std.Build) void {
else => @panic("unsupported target for ghostty_vt"),
};
plugin.module.addIncludePath(ghostty_vt.path("include"));
// libghostty-vt's header, translated once into a module of its own (`c`): Zig 0.17 removed
// `@cImport`. `GHOSTTY_STATIC` makes `GHOSTTY_API` a no-op, right for the static lib.
const vt_h = b.addTranslateC(.{
.root_source_file = ghostty_vt.path("include/ghostty/vt.h"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
vt_h.addIncludePath(ghostty_vt.path("include"));
vt_h.defineCMacro("GHOSTTY_STATIC", "1");
plugin.module.addImport("c", vt_h.createModule());
plugin.module.addObjectFile(ghostty_vt.path(ghostty_vt_lib));
plugin.module.link_libc = true;

Expand Down
6 changes: 3 additions & 3 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.name = .ghostty,
.version = "0.0.1",
.fingerprint = 0x64407a2a356ac9fe,
.minimum_zig_version = "0.16.0",
.minimum_zig_version = "0.17.0",
.dependencies = .{
.ghostty_vt = .{
.url = "https://github.com/fizzyedit/ghostty_vt/releases/download/v0.1.2/ghostty-vt-v0.1.2.tar.gz",
Expand All @@ -12,8 +12,8 @@
// The published SDK, not a path into a checkout: a release has to build from a
// clean clone, and the release asset (never the tag's git archive) is the SDK
// package alone — the monorepo root zon carries the app's own dependencies.
.url = "https://github.com/fizzyedit/fizzy/releases/download/sdk-v0.2.29/fizzy-sdk-v0.2.29.tar.gz",
.hash = "fizzy-0.2.29-SGBwY2sxJgCLLSPt4HLdlMSg7WtcP4K0fdtXI5WwJl2d",
.url = "https://github.com/fizzyedit/fizzy/releases/download/sdk-v0.2.30/fizzy-sdk-v0.2.30.tar.gz",
.hash = "fizzy-0.2.30-SGBwY1QnJwDznUMVnSLATxXgH2e8_Vz7eMwLj9UQ0sVU",
},
},
.paths = .{
Expand Down
4 changes: 2 additions & 2 deletions plugin.zig.zon
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.{
.id = "ghostty",
.name = "Ghostty",
.version = "0.1.31",
.min_sdk_version = "0.2.29",
.version = "0.1.32",
.min_sdk_version = "0.2.30",
.description = "Ghostty terminal emulator plugin for fizzy",
.tags = .{ "terminal", "ghostty" },
.author = "foxnne",
Expand Down
2 changes: 1 addition & 1 deletion src/Pty.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! Windows: ConPTY + PowerShell (`Pty_windows.zig`).
const builtin = @import("builtin");

const backend = if (builtin.os.tag == .windows)
const backend = if (builtin.target.os.tag == .windows)
@import("Pty_windows.zig")
else
@import("Pty_unix.zig");
Expand Down
4 changes: 2 additions & 2 deletions src/Pty_unix.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub const Pty = struct {
extern "c" fn ioctl(fd: c_int, request: c_ulong, ...) c_int;
extern "c" fn _exit(code: c_int) noreturn;

const TIOCSWINSZ: c_ulong = switch (builtin.os.tag) {
const TIOCSWINSZ: c_ulong = switch (builtin.target.os.tag) {
.linux => 0x5414,
else => 0x80087467, // macOS / BSD
};
Expand Down Expand Up @@ -103,7 +103,7 @@ pub const Pty = struct {
while (off < bytes.len) {
const n = std.c.write(self.master, bytes.ptr + off, bytes.len - off);
if (n < 0) {
if (std.c._errno().* == @intFromEnum(std.c.E.INTR)) continue;
if (std.c._errno().* == @backingInt(std.c.E.INTR)) continue;
break; // real error (e.g. EPIPE on child exit) — drop the rest
}
off += @intCast(n);
Expand Down
10 changes: 3 additions & 7 deletions src/c.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//! C bindings for libghostty-vt (from the ghostty_vt package dependency). The include path
//! and static archive are wired in `build.zig`. `GHOSTTY_STATIC` makes the `GHOSTTY_API`
//! visibility/import-export attributes a no-op, which is correct when linking the static lib.
pub const c = @cImport({
@cDefine("GHOSTTY_STATIC", "1");
@cInclude("ghostty/vt.h");
});
//! C bindings for libghostty-vt (from the ghostty_vt package dependency): its header, translated
//! in `build.zig`, which also wires the static archive.
pub const c = @import("c");
14 changes: 7 additions & 7 deletions src/input.zig
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ const Mapped = struct {

fn mapKey(code: dvui.enums.Key) ?Mapped {
const Key = dvui.enums.Key;
const ci = @intFromEnum(code);
const ci = @backingInt(code);

if (ci >= @intFromEnum(Key.a) and ci <= @intFromEnum(Key.z)) {
const off: c_int = @intCast(ci - @intFromEnum(Key.a));
if (ci >= @backingInt(Key.a) and ci <= @backingInt(Key.z)) {
const off: c_int = @intCast(ci - @backingInt(Key.a));
return .{ .key = c.GHOSTTY_KEY_A + off, .cp = @intCast('a' + off) };
}
if (ci >= @intFromEnum(Key.zero) and ci <= @intFromEnum(Key.nine)) {
const off: c_int = @intCast(ci - @intFromEnum(Key.zero));
if (ci >= @backingInt(Key.zero) and ci <= @backingInt(Key.nine)) {
const off: c_int = @intCast(ci - @backingInt(Key.zero));
return .{ .key = c.GHOSTTY_KEY_DIGIT_0 + off, .cp = @intCast('0' + off) };
}
if (ci >= @intFromEnum(Key.f1) and ci <= @intFromEnum(Key.f12)) {
const off: c_int = @intCast(ci - @intFromEnum(Key.f1));
if (ci >= @backingInt(Key.f1) and ci <= @backingInt(Key.f12)) {
const off: c_int = @intCast(ci - @backingInt(Key.f1));
return .{ .key = c.GHOSTTY_KEY_F1 + off, .cp = 0 };
}

Expand Down
2 changes: 1 addition & 1 deletion src/render.zig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const input = @import("input.zig");
/// the app process itself inherited, which for a packaged `.app` launched from Finder/Dock is
/// `/` rather than `~`. Null if the relevant env var isn't set.
fn defaultCwd() ?[]const u8 {
const name = if (builtin.os.tag == .windows) "USERPROFILE" else "HOME";
const name = if (builtin.target.os.tag == .windows) "USERPROFILE" else "HOME";
const value = std.c.getenv(name) orelse return null;
return std.mem.span(value);
}
Expand Down
Loading