summaryrefslogtreecommitdiff
path: root/src/pardes.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/pardes.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/pardes.zig')
-rw-r--r--src/pardes.zig32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 5f330712..8da0922d 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -807,7 +807,7 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest
if (comptime !syntax.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\n" ** 30) ++ " }\n};\n");
+ const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][16]u8, @splat(" // body\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;
@@ -1247,7 +1247,9 @@ test "Def and Refs are a speaking file's tag words; gd, gr and a 2-1 chord all r
const r = p.rects[0];
const x0 = r.x + config.GUTTER + panes.File.gutterWidth(pane);
const use_y = p.bodyTop(pane, r) + 1;
- const tag = try tagline.tagText(p, p.scratch.allocator(), pane);
+ // Copied out of the scratch arena, which each p.update resets.
+ const tag = try std.testing.allocator.dupe(u8, try tagline.tagText(p, p.scratch.allocator(), pane));
+ defer std.testing.allocator.free(tag);
for ([_]struct { word: []const u8, kind: lsp.Kind }{ .{ .word = " Def ", .kind = .definition }, .{ .word = " Refs", .kind = .references } }) |w| {
// B1 sweeps the use of `alpha` on the second line (bytes 30..35),
// leaving the cursor at its far end.
@@ -1348,7 +1350,7 @@ test "acme placement: under a pane's text when it has many blank rows, else halv
try std.testing.expectEqual(text_end, p.rects[second].y);
// Fill both with text: no blank space is big, so the biggest pane is
// halved.
- const full = "x\n" ** 80;
+ const full = std.mem.asBytes(&@as([80][2]u8, @splat("x\n".*)));
for ([_]usize{ top, second }) |id| panes.File.setContent(p, &p.panes[id].?.file.?, try p.gpa.dupe(u8, full));
p.sync();
const big = if (p.rects[second].h >= p.rects[top].h) second else top;
@@ -2006,7 +2008,7 @@ test "a command pane shows how its command ended, and the next command there run
try std.testing.expectEqual(@as(usize, 0), Count.signals);
p.host = host_before;
// A command line longer than a command pane takes is refused.
- const long = "x" ** (exec.command_max + 1);
+ const long = &@as([exec.command_max + 1]u8, @splat('x'));
try std.testing.expectEqual(@as(?usize, null), exec.execute(p, 1, long));
}
@@ -2970,9 +2972,9 @@ test "restored terminals keep monotonic nonzero pane identities" {
fn chordName(comptime c: config.Chord) []const u8 {
comptime {
const mods = (if (c.ctrl) "C-" else "") ++ (if (c.alt) "A-" else "") ++ (if (c.shift) "S-" else "");
- for (@typeInfo(Key).@"struct".decls) |d| {
- if (@TypeOf(@field(Key, d.name)) != u21) continue;
- if (@field(Key, d.name) == c.cp) return mods ++ d.name;
+ for (@typeInfo(Key).@"struct".decl_names) |d| {
+ if (@TypeOf(@field(Key, d)) != u21) continue;
+ if (@field(Key, d) == c.cp) return mods ++ d;
}
if (c.cp < 0x20 or c.cp > 0x7e) @compileError("chord has no name for the index");
return mods ++ &[_]u8{@as(u8, @intCast(c.cp))};
@@ -3088,11 +3090,11 @@ pub const builtin_rows: [std.enums.values(Builtin).len]Row = blk: {
for (std.enums.values(Builtin), 0..) |b, i| {
const keys = if (config.leader_path.get(b)) |path| leaderKeys(path) else "";
const rest = shortcuts(b);
- const named = @tagName(b) ++ (if (rest.len == 0) "" else (" " ** (namew - @tagName(b).len)) ++ " " ++ rest);
+ const named = @tagName(b) ++ (if (rest.len == 0) "" else (&@as([namew - @tagName(b).len]u8, @splat(' '))) ++ " " ++ rest);
rows[i] = .{
.path = config.leader_path.get(b),
.cmd = b,
- .line = keys ++ (" " ** (4 + keyw - keys.len)) ++ " " ++ named,
+ .line = keys ++ (&@as([4 + keyw - keys.len]u8, @splat(' '))) ++ " " ++ named,
};
}
const last = "\x7f";
@@ -3111,8 +3113,8 @@ comptime {
@setEvalBranchQuota(20000); // one branch per string byte, behind the decl walk that folds Builtin
var it = std.mem.tokenizeScalar(u8, config.topbar_str, ' ');
words: while (it.next()) |w| {
- for (@typeInfo(Builtin).@"enum".fields) |f|
- if (std.mem.eql(u8, f.name, w)) continue :words;
+ for (@typeInfo(Builtin).@"enum".field_names) |name|
+ if (std.mem.eql(u8, name, w)) continue :words;
@compileError("topbar word is not a builtin: " ++ w);
}
}
@@ -4499,7 +4501,7 @@ pub const Pardes = struct {
/// Panes made this step that found no room in their column
/// (exec.placeNew): closed at the step's end, once whatever made them
/// is done with them.
- unplaced: std.StaticBitSet(MAX_PANES) = .initEmpty(),
+ unplaced: std.StaticBitSet(MAX_PANES) = .empty,
/// A look's word search is running (look.lookUnresolved): from a
/// terminal its rows refill the directory's one +Search (Output).
word_look: bool = false,
@@ -5018,7 +5020,7 @@ pub const Pardes = struct {
if (p.dump_out) |d| gpa.free(d);
p.fallback.deinit();
if (p.last_dump) |d| gpa.free(d);
- if (p.custom_theme) |theme_value| std.zon.parse.free(gpa, theme_value);
+ if (p.custom_theme) |theme_value| gpa.free(theme_value.name);
if (p.chord_arg) |a| gpa.free(a);
for (p.spawn_dirs) |d| if (d) |dir| gpa.free(dir);
p.pipe.deinit(gpa);
@@ -8508,7 +8510,7 @@ test "raw tty Ctrl-B switches to editor mode without sending child input" {
test "the jump list never holds two entries in a row the same, when the one between them goes" {
const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 40 });
defer p.deinit();
- const pane = try p.setTestFile("a\n" ** 200);
+ const pane = try p.setTestFile(std.mem.asBytes(&@as([200][2]u8, @splat("a\n".*))));
const at: Loc = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 1 };
// A, a pane long closed with no file to keep it, A again, then far on.
p.jumps[0] = at;
@@ -9054,7 +9056,7 @@ const JumpsTest = struct {
fn init(order: []const u8) !JumpsTest {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 80 });
errdefer p.deinit();
- const text = "row\n" ** 100;
+ const text = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*)));
_ = try p.setTestFile(text);
var t: JumpsTest = .{ .p = p };
for ([_][]const u8{ "/b.txt", "/test.txt", "" }, 1..) |path, n| {