From 8ac6db5662dd2db0f082e1651835f1db36e235f8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 24 Oct 2026 11:57:35 -0300 Subject: Search converge 4/6: the disk engine, Grep and Find's listing on a worker (rg when there, else a sorted walk), generation-numbered batches, a debounce, a 2000-line cap and More, and the declarations parse off the loop --- src/gui/gui.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/gui') diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 5017ab53..49a98f5b 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2202,6 +2202,8 @@ fn localSession( }; defer { if (queue.lsp_task) |*task| task.future.cancel(io); + // Its worker may be waiting on the queue for room. + core.stream.cancelTask(); queue.deinit(); } var pipe_tasks: PipeTasks = .{}; @@ -2573,6 +2575,8 @@ fn runGrid(init: std.process.Init, opts_in: pardes.Options) !void { }; defer { if (queue.lsp_task) |*task| task.future.cancel(io); + // Its worker may be waiting on the queue for room. + core.stream.cancelTask(); queue.deinit(); } var pipe_tasks: PipeTasks = .{}; @@ -3815,6 +3819,7 @@ const Shell = struct { .open_link = openLink, .lsp = lsp, .pipe = pipe, + .search = search, }; const grid_vtable: pardes.Host.VTable = vt: { @@ -3908,6 +3913,11 @@ const Shell = struct { s.saw_event = true; s.pipe_tasks.finish(s.io, response_value.id); }, + .search => |b| { + s.core.update(.{ .search = b }); + b.deinit(s.gpa); + s.saw_event = true; + }, .files_changed => check_files = true, .fs_ready => {}, }; @@ -4473,6 +4483,12 @@ fn pipe(ctx: ?*anyopaque, id: u32) void { s.core.reportError(s.core.active, "pipe", error.WorkersUnavailable); } +fn search(ctx: ?*anyopaque, gen: u32) void { + const s = shellOf(ctx); + if (s.threads_ok) return pardes.Stream.start(s.io, s.gpa, s.core, gen, s.queue, Queue.pushSearch); + pardes.Stream.runHere(s.core, gen); +} + fn pollCwds(core: *pardes.Pardes, ptys: *[pardes.MAX_PANES]?Pty) void { for (ptys, 0..) |slot, id| if (slot) |pt| { if (pt.fd < 0) continue; -- cgit v1.3