diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-24 13:55:12 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-24 16:02:22 -0300 |
| commit | 4c635f357adb95235429d8905b8598a2643b4f3b (patch) | |
| tree | dd4f4f9b7e66b2bad71a0d30541c2b4ce2bb4cb9 /src/host_io.zig | |
| parent | 95321ab082a750f4f1ef26d9bb21d1d3d01274f2 (diff) | |
| download | pardes-4c635f357adb95235429d8905b8598a2643b4f3b.tar.gz pardes-4c635f357adb95235429d8905b8598a2643b4f3b.zip | |
drag 2/3: a pane's or column's grip let go past the window's edge opens it in a new window (Handover.zig)
Diffstat (limited to 'src/host_io.zig')
| -rw-r--r-- | src/host_io.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/host_io.zig b/src/host_io.zig index f5d6f375..af284e84 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -51,6 +51,9 @@ pub const Host = struct { /// Start the streaming search of this generation on a worker /// (pardes.Stream.start); absent, it runs on the loop. search: ?*const fn (ctx: ?*anyopaque, gen: u32) void = null, + /// Carry the dump of handover `seq` to another window on a worker + /// (Handover.start), which answers through the inbox's `handed`. + hand_over: ?*const fn (ctx: ?*anyopaque, seq: u32, bytes: []const u8) void = null, }; }; @@ -135,6 +138,9 @@ pub const Inbox = struct { /// A streaming search's rows (pardes.Stream), of whatever generation: /// the core drops a stale one. search: pardes.Stream.Batch, + /// How a handover went (Handover.zig): `words` is where it went, or + /// why it did not; gpa-owned. + handed: struct { seq: u32, ok: bool, words: []u8 }, files_changed, fs_ready, @@ -148,6 +154,7 @@ pub const Inbox = struct { response.deinit(gpa); }, .search => |b| b.deinit(gpa), + .handed => |h| gpa.free(h.words), .eof, .files_changed, .fs_ready => {}, } } @@ -432,6 +439,13 @@ pub const Inbox = struct { q.push(.{ .pipe = response }); } + /// A handover's end (Handover.Job.post). + pub fn pushHanded(ctx: ?*anyopaque, seq: u32, ok: bool, words: []const u8) void { + const q: *Inbox = @ptrCast(@alignCast(ctx.?)); + const copy = q.gpa.dupe(u8, words) catch return; + q.push(.{ .handed = .{ .seq = seq, .ok = ok, .words = copy } }); + } + /// A streaming search's batch (pardes.Stream.start's sink). Never /// dropped for want of room, as output is not: the worker waits for /// room, a wait its cancel ends (false: it stops). |
