summaryrefslogtreecommitdiff
path: root/src/gui/gui.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-21 14:35:15 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:15 -0300
commitbc3d18d27f9fc1155db7fac3946c4d38774f9e65 (patch)
tree9178ce95952797f8a78b16c2b805e53368efb35a /src/gui/gui.zig
parent1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2 (diff)
downloadpardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.tar.gz
pardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.zip
Build with Zig 0.17
ghostty, libvaxis and uucode move to ghostty's 0.17 pins, cloud9 to its 0.17 main, SDL to castholm's release-3.4.x (3.4.18), zstbi and tree-sitter to forks with 0.17 build files (see build.zig.zon). A bare zig build copies the binaries into ~/.local/bin (-Dhome-install=false leaves it out): 0.17 keeps the prefix from build scripts. A terminal's edited copy goes when the program clears the screen. tinywin.snap is gone; perf baselines are re-recorded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/gui/gui.zig')
-rw-r--r--src/gui/gui.zig20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 5a026664..b8687fd3 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -25,11 +25,7 @@ const ninep_io = @import("../9p_io.zig");
const detached_client = @import("../detached/client.zig");
const tracy = @import("../tracy.zig");
-pub const c = @cImport({
- @cDefine("SDL_DISABLE_OLD_NAMES", "1");
- @cInclude("SDL3/SDL.h");
- @cInclude("font.h");
-});
+pub const c = @import("gui_c"); // SDL3 and font.h, translated by build.zig
const host_io = @import("../host_io.zig");
extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int;
@@ -4806,7 +4802,7 @@ fn dumpThemes(ctx: ?*anyopaque, pane: u8) void {
}
fn putClipboard(gpa: std.mem.Allocator, text: []const u8) void {
- const z = gpa.dupeZ(u8, text) catch return;
+ const z = gpa.dupeSentinel(u8, text, 0) catch return;
defer gpa.free(z);
_ = c.SDL_SetClipboardText(z.ptr);
}
@@ -5131,7 +5127,7 @@ test "a wheel over codex in a terminal reaches its pty as the mouse reports it a
wheelAt(&g, &in, .{ .y = 1, .integer_y = 1 }, mc);
try std.testing.expectEqualStrings("\x1b[<64;6;4M", try Sent.take(core, &sent));
wheelAt(&g, &in, .{ .y = -3, .integer_y = -3 }, mc);
- try std.testing.expectEqualStrings("\x1b[<65;6;4M" ** 3, try Sent.take(core, &sent));
+ try std.testing.expectEqualStrings(std.mem.asBytes(&@as([3][10]u8, @splat("\x1b[<65;6;4M".*))), try Sent.take(core, &sent));
try std.testing.expectEqual(@as(i32, 0), g.scroll_notch);
try std.testing.expect(g.scroll_pane == null);
// A touchpad's fractions add up to a turn.
@@ -7157,7 +7153,7 @@ test "every pixel of a grip column is band, button or ring, and the button sits
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .cols = 60, .rows = 20 });
defer core.deinit();
- const pane = try core.setTestFile("text\n" ** 60);
+ const pane = try core.setTestFile(std.mem.asBytes(&@as([60][5]u8, @splat("text\n".*))));
pane.tag.own = try gpa.dupe(u8, "second\nthird");
core.newScratchBelow(0);
for ([_]struct { w: u32, h: u32, tag: u32 }{ .{ .w = 10, .h = 20, .tag = 12 }, .{ .w = 17, .h = 35, .tag = 30 }, .{ .w = 9, .h = 19, .tag = 15 }, .{ .w = 12, .h = 24, .tag = 24 } }) |m| for ([_]bool{ false, true }) |bottom| for ([_]usize{ 0, 1 }) |focus| for ([_]bool{ false, true }) |dirty| {
@@ -10156,7 +10152,7 @@ test "the selection glows round its block, on the body only, fading in over 100
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 });
defer core.deinit();
- _ = try core.setTestFile("some text on a line\n" ** 30);
+ _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*))));
core.settings.selection_glow = true;
pardes.test_api.sync(core);
const s = try core.render(core.scratch.allocator());
@@ -10206,7 +10202,7 @@ test "a hovered word glows along its foot, never over the cursor, fading in over
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 });
defer core.deinit();
- _ = try core.setTestFile("some text on a line\n" ** 30);
+ _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*))));
core.settings.hover_glow = true;
pardes.test_api.sync(core);
const s = try core.render(core.scratch.allocator());
@@ -10256,7 +10252,7 @@ test "occlusion shades each body's edges, inside it, never a tag, a grip or the
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 });
defer core.deinit();
- _ = try core.setTestFile("some text on a line\n" ** 30);
+ _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*))));
core.settings.occlusion = true;
pardes.test_api.sync(core);
const s = try core.render(core.scratch.allocator());
@@ -10295,7 +10291,7 @@ test "a body tells its first line, and lapis's dots under it move a quarter as f
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 });
defer core.deinit();
- const pane = try core.setTestFile("line\n" ** 80);
+ const pane = try core.setTestFile(std.mem.asBytes(&@as([80][5]u8, @splat("line\n".*))));
pane.scrollBy(8);
try std.testing.expect(core.executeBuiltinLine(0, "Theme lapis"));
core.settings.parallax = true;