summaryrefslogtreecommitdiff
path: root/src/draw.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/draw.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/draw.zig')
-rw-r--r--src/draw.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/draw.zig b/src/draw.zig
index b35d55e8..e6420ed4 100644
--- a/src/draw.zig
+++ b/src/draw.zig
@@ -1598,7 +1598,7 @@ test "a tag of three rows has its grip on the first, and band under it that stil
test "place puts every part where the painters and layers put it, in every layout" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 });
defer p.deinit();
- _ = try p.setTestFile("placed\n" ** 80);
+ _ = try p.setTestFile(std.mem.asBytes(&@as([80][7]u8, @splat("placed\n".*))));
p.newColumn(0);
p.newScratchIn(0, p.activeColumn().?);
p.newScratchBelow(0);
@@ -1713,7 +1713,7 @@ test "a notice wider than its band, as a shader's compile error is, draws its en
_ = try p.setTestFile("text\n");
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer arena.deinit();
- const long = "Shader /home/someone/shaders/test_shadertoy_invalid.glsl: error: Linking fragment stage: No function definition (body) found: " ** 3;
+ const long = std.mem.asBytes(&@as([3][126]u8, @splat("Shader /home/someone/shaders/test_shadertoy_invalid.glsl: error: Linking fragment stage: No function definition (body) found: ".*)));
for ([_][]const u8{ "Msg " ++ long, "" }) |line| {
// The Msg builtin, and the path a failed compile takes (Post.zig).
if (line.len > 0) try std.testing.expect(p.executeBuiltinLine(p.active, line)) else p.setMessage(p.active, long);
@@ -1952,7 +1952,7 @@ test "the focused cursor glides a jump, lands a step at once, and is exact at re
if (!builtins.capabilities.lift) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 30 });
defer p.deinit();
- _ = try p.setTestFile("some text on a line\n" ** 20);
+ _ = try p.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*))));
p.settings.cursor_blink = false;
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer arena.deinit();
@@ -2078,7 +2078,7 @@ test "a terminal's cursor lands with scrolling output, never gliding against it"
defer arena.deinit();
const ms = std.time.ns_per_ms;
var now: u64 = std.time.ns_per_s;
- p.update(.{ .output = .{ .pane = @intCast(term), .bytes = "line\r\n" ** 20 ++ "$ some command typed" } });
+ p.update(.{ .output = .{ .pane = @intCast(term), .bytes = std.mem.asBytes(&@as([20][6]u8, @splat("line\r\n".*))) ++ "$ some command typed" } });
p.advance(now);
_ = try p.render(arena.allocator());
// Enter: three lines of output scroll up, the cursor to a new prompt.
@@ -2101,10 +2101,10 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev
const random = prng.random();
const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 });
defer p.deinit();
- _ = try p.setTestFile("fuzz\n\u{754c}\u{754c} wide\n" ** 20);
+ _ = try p.setTestFile(std.mem.asBytes(&@as([20][17]u8, @splat("fuzz\n\u{754c}\u{754c} wide\n".*))));
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer arena.deinit();
- const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", "long-" ** 20, " " };
+ const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", std.mem.asBytes(&@as([20][5]u8, @splat("long-".*))), " " };
const commands = [_][]const u8{ "New", "Newcol", "Collapse", "Tagbottom", "TreeContext", "Wrap", "Find", "Del", "FocusTint", "Debug" };
var text: std.ArrayListUnmanaged(u8) = .empty;
defer text.deinit(std.testing.allocator);
@@ -2143,7 +2143,7 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev
// A tag of several rows.
5 => if (p.panes[p.active]) |pane| {
text.clearRetainingCapacity();
- for (0..random.uintAtMost(usize, 5)) |_| try text.appendSlice(std.testing.allocator, if (random.boolean()) " Look\nmore \u{754c}" else "\n" ++ "x" ** 150);
+ for (0..random.uintAtMost(usize, 5)) |_| try text.appendSlice(std.testing.allocator, if (random.boolean()) " Look\nmore \u{754c}" else "\n" ++ &@as([150]u8, @splat('x')));
if (pane.tag.own) |own| std.testing.allocator.free(own);
pane.tag.own = try std.testing.allocator.dupe(u8, text.items);
},
@@ -2173,7 +2173,7 @@ test "a wide glyph cut by a tag's or a notice's edge is joined into the grid as
defer arena.deinit();
const pane = p.panes[p.active].?;
// Both alignments, so one of them puts a wide glyph across each edge.
- for ([_][]const u8{ "\u{754c}" ** 30, "x" ++ "\u{754c}" ** 30 }) |wide| {
+ for ([_][]const u8{ std.mem.asBytes(&@as([30][3]u8, @splat("\u{754c}".*))), "x" ++ std.mem.asBytes(&@as([30][3]u8, @splat("\u{754c}".*))) }) |wide| {
if (pane.tag.own) |own| std.testing.allocator.free(own);
pane.tag.own = try std.testing.allocator.dupe(u8, wide);
var message: [200]u8 = undefined;
@@ -2201,7 +2201,7 @@ test "a body with context rows is painted once, and the grid's rows are what a p
if (comptime !@import("syntax.zig").enabled) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 });
defer p.deinit();
- const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (" // body line\n" ** 30) ++ " }\n};\n");
+ const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][21]u8, @splat(" // body line\n".*)))) ++ " }\n};\n");
p.gpa.free(pane.file.?.path);
pane.file.?.path = try p.gpa.dupe(u8, "/test.zig");
if (!panes.File.supportsContext(pane)) return error.SkipZigTest;
@@ -2250,7 +2250,7 @@ test "a body with context rows is painted once, and the grid's rows are what a p
/// Two columns, the file in the left one and a shell in the right, the
/// right one focused with its cursor settled.
fn twoColumns(p: *Pardes, arena: *std.heap.ArenaAllocator) !void {
- _ = try p.setTestFile("some text on a line\n" ** 6);
+ _ = try p.setTestFile(std.mem.asBytes(&@as([6][20]u8, @splat("some text on a line\n".*))));
_ = try p.newShell(1, "");
try std.testing.expect(layout.splitColumn(p, 0, 1, false));
p.sync();
@@ -2386,7 +2386,7 @@ test "a pane focus reaches brightens on the same spring the one it leaves dims o
if (!builtins.capabilities.lift) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 });
defer p.deinit();
- _ = try p.setTestFile("some text on a line\n" ** 4);
+ _ = try p.setTestFile(std.mem.asBytes(&@as([4][20]u8, @splat("some text on a line\n".*))));
p.newScratchBelow(0);
p.settings.inactive_dim = 40;
p.settings.motion = .smooth;