diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 22:46:26 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 71a9f04342493325c10b1b9bc122a88d41143782 (patch) | |
| tree | c9b1f27a84404a8332c4066a56d922a031eec194 /src/macos.zig | |
| parent | d126715cd20a39dbc10870318968546f5e371b97 (diff) | |
| download | pardes-71a9f04342493325c10b1b9bc122a88d41143782.tar.gz pardes-71a9f04342493325c10b1b9bc122a88d41143782.zip | |
Give the pipe its own fields in Pipe
Not a pure move: state moves. Pardes's `pipe_seq` and `pipe_wait` become
Pipe.zig's own fields `seq` and `wait`, and Pardes embeds one as
`pipe: Pipe = .{}`. pipeRequest reads only the request in flight, so it now
takes `pipe: *const Pipe` and the four shells call
`core.pipe.pipeRequest(id)` (their Pipe imports go away again); the other
pipe functions still need the panes and keep `p: *Pardes`, writing
`p.pipe.seq/wait`. Field reads in dump.zig, the shells' tests and two test
files follow (`core.pipe_wait` becomes `core.pipe.wait`). No behaviour
change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/macos.zig')
| -rw-r--r-- | src/macos.zig | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/macos.zig b/src/macos.zig index dc5b79d0..ccbb5dd5 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -18,7 +18,6 @@ const host_io = @import("host_io.zig"); const fonts = @import("fonts.zig"); // the shared fallback preference order const tracy = @import("tracy.zig"); // no-op unless -Dtracy names a checkout const selection_pipe = @import("selection_pipe.zig"); // Job, runJob and Tasks -const Pipe = @import("Pipe.zig"); const crash = @import("crash.zig"); pub const panic = std.debug.FullPanic(struct { @@ -344,9 +343,9 @@ test "mac worker setup failures finish matching LSP and pipe requests" { core.update(.{ .key = .{ .cp = '|' } }); core.update(.{ .key = .{ .cp = 't', .text = "tr a-z A-Z" } }); core.update(.{ .key = .{ .cp = pardes.Key.enter } }); - const pipe_id = core.pipe_wait.?.id; + const pipe_id = core.pipe.wait.?.id; pipeRequest(&st, pipe_id); - try std.testing.expect(core.pipe_wait == null); + try std.testing.expect(core.pipe.wait == null); try std.testing.expectEqualStrings("abc", pane.file.?.content); try std.testing.expect(st.lsp_task == null); try std.testing.expectEqual(@as(usize, 0), st.pipe_tasks.len); @@ -1471,7 +1470,7 @@ test "mac Restore keeps host state and rejects callbacks from the old core" { st.core.update(.{ .key = .{ .cp = '|' } }); st.core.update(.{ .key = .{ .cp = 't', .text = "tr a-z A-Z" } }); st.core.update(.{ .key = .{ .cp = pardes.Key.enter } }); - const pipe_id = st.core.pipe_wait.?.id; + const pipe_id = st.core.pipe.wait.?.id; try std.testing.expect(st.pipe_tasks.add(.{ .id = pipe_id, .future = .{ .any_future = null, .result = {} } })); const output = try gpa.dupe(u8, "FRESH"); const outputs = gpa.dupe([]u8, &.{output}) catch |err| { @@ -1480,7 +1479,7 @@ test "mac Restore keeps host state and rejects callbacks from the old core" { }; st.inbox.push(gpa, std.testing.io, .{ .pipe = .{ .id = pipe_id, .success = true, .outputs = outputs } }); try std.testing.expect(drainInbox(&st)); - try std.testing.expect(st.core.pipe_wait == null); + try std.testing.expect(st.core.pipe.wait == null); try std.testing.expectEqual(@as(usize, 0), st.pipe_tasks.len); try std.testing.expectEqualStrings("FRESH body\n", pane.file.?.content); } @@ -2352,7 +2351,7 @@ fn pipeRequest(ctx: ?*anyopaque, id: u32) void { st.core.update(.{ .pipe_resp = .{ .id = id, .success = false, .outputs = &.{} } }); return; } - const view = Pipe.pipeRequest(st.core, id) orelse return; + const view = st.core.pipe.pipeRequest(id) orelse return; const job = selection_pipe.Job.copy(st.gpa, view) catch |err| { st.core.update(.{ .pipe_resp = .{ .id = id, .success = false, .outputs = &.{} } }); return st.core.reportError(st.core.active, "pipe", err); |
