diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 19:22:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 19:51:13 -0300 |
| commit | 4e1432049765be6e793a3834c93c4cd5318e82bc (patch) | |
| tree | aa8e98c4cb2b7ee6ba33a49255fa85cab0089e2d /core/Pipe.zig | |
| parent | 486f347adeed5bac6aaabe8be34e6a69bf323a62 (diff) | |
| parent | 2d75490196a9d15eff6ac471e9584101a5697afe (diff) | |
| download | pardes-4e1432049765be6e793a3834c93c4cd5318e82bc.tar.gz pardes-4e1432049765be6e793a3834c93c4cd5318e82bc.zip | |
integration: six slot fields typed, the docking vocabulary, the Mac's callbacks and consumer-test, on six small faults: pardes-slots (Pipe.PendingPipe.pane, Ask.wait.pane, theme_file_pane, ThemeFileRequest.pane as Pane.Id; Authority.view_of and Peer.view as View.Id; layout.dockFrom and the prose; macos State.callbacks; the build step consumer-test) and pardes-merge42; one conflict, in Peers.detach, where the pair's lifetime rule (daemon.keepSession) and the view's type (peer.view.index()) met on neighbouring lines: both kept; tui core-test 874/1031 (157 skipped), shell-test 1073/1076, term-test 17/17, both soaks diverged 0, unequal 0, unlisted 0, the window builds; this line carries the client's heap corruption that came with pardes-merge40 (a fix is being made): not gated further until it has it
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Pipe.zig')
| -rw-r--r-- | core/Pipe.zig | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/core/Pipe.zig b/core/Pipe.zig index cf61b78f..012ce689 100644 --- a/core/Pipe.zig +++ b/core/Pipe.zig @@ -52,7 +52,7 @@ pub const PendingPipe = struct { /// The digest's walk (core/walk.zig) of the ranges, as far as they go. pub const replica = .{ .len = .{.{ "ranges", "nranges" }} }; id: u32, - pane: usize, + pane: Pane.Id, serial: u32, /// The text piped: the pane's body or tag, or a header (`column` /// names which). @@ -133,7 +133,7 @@ pub fn submitPipe(p: *Pardes, id: usize) void { if (p.pipe.wait) |*old| old.deinit(); p.pipe.wait = .{ .id = p.pipe.seq, - .pane = id, + .pane = .at(id), .serial = pane.serial, .what = t.what, .column = p.headerColumn() orelse 0, @@ -166,16 +166,16 @@ fn pipeFailed(p: *Pardes, wait: *const PendingPipe, failure: ?selection_pipe.Fai var out: std.Io.Writer.Allocating = .init(p.gpa); defer out.deinit(); const w = &out.writer; - w.print("| {s}\n\n", .{wait.command}) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + w.print("| {s}\n\n", .{wait.command}) catch |err| return p.reportError(wait.pane, "pipe", err); if (wait.inputs.len > 1) if (failure) |fail| - w.print("selection {d} of {d}: ", .{ fail.index + 1, wait.inputs.len }) catch |err| return p.reportError(.at(wait.pane), "pipe", err); - writeFailure(w, failure) catch |err| return p.reportError(.at(wait.pane), "pipe", err); - const content = out.toOwnedSlice() catch |err| return p.reportError(.at(wait.pane), "pipe", err); + w.print("selection {d} of {d}: ", .{ fail.index + 1, wait.inputs.len }) catch |err| return p.reportError(wait.pane, "pipe", err); + writeFailure(w, failure) catch |err| return p.reportError(wait.pane, "pipe", err); + const content = out.toOwnedSlice() catch |err| return p.reportError(wait.pane, "pipe", err); const was = p.view().active; - panes.Output.openErrors(p, wait.pane, content) catch |err| { + panes.Output.openErrors(p, wait.pane.index(), content) catch |err| { p.gpa.free(content); // Nowhere to put the report is itself worth one line. - p.reportError(.at(wait.pane), "pipe", err); + p.reportError(wait.pane, "pipe", err); return; }; if (p.panes[was] != null) p.view().active = was; @@ -250,7 +250,7 @@ pub fn pipeResponse( if (!success or outputs.len != wait.inputs.len) return pipeFailed(p, &wait, failure); - const pane = p.panes[wait.pane] orelse return; + const pane = p.panes[wait.pane.index()] orelse return; if (pane.serial != wait.serial) return; const t: *Text = switch (wait.what) { .body => &pane.body, @@ -259,13 +259,13 @@ pub fn pipeResponse( .workspace => &p.global_tag, .input => return, }; - const content = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + const content = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(wait.pane, "pipe", err); const changed = if (t.what == .body) changed: { const f = pane.file orelse return; if (!panes.Output.fileTraits(f.output).saves) return; break :changed f.revision != wait.revision; } else std.hash.Wyhash.hash(0, content) != wait.sum; - if (changed) return p.reportError(.at(wait.pane), "pipe", error.FileChangedWhileFiltering); + if (changed) return p.reportError(wait.pane, "pipe", error.FileChangedWhileFiltering); if (wait.how == .ignore) return; if (wait.how == .keep) { @@ -296,14 +296,14 @@ pub fn pipeResponse( const cut = pipeCut(&wait, content, i) orelse return; const output = pipeOutput(&wait, outputs, content, i); if (output.len > selection_pipe.max_stdout_bytes) - return p.setMessage(.at(wait.pane), std.fmt.bufPrint(&said, "pipe: an output of {d} bytes, past {d}: the text is left as it was", .{ output.len, selection_pipe.max_stdout_bytes }) catch unreachable); // two numbers fit 128 + return p.setMessage(wait.pane, std.fmt.bufPrint(&said, "pipe: an output of {d} bytes, past {d}: the text is left as it was", .{ output.len, selection_pipe.max_stdout_bytes }) catch unreachable); // two numbers fit 128 total_output += output.len; // each under 1 MiB, at most max_selections of them if (total_output > selection_pipe.max_total_stdout_bytes) - return p.setMessage(.at(wait.pane), std.fmt.bufPrint(&said, "pipe: {d} bytes of output in all, past {d}: the text is left as it was", .{ total_output, selection_pipe.max_total_stdout_bytes }) catch unreachable); // two numbers fit 128 - if (i > 0 and cut.lo < ops[i - 1].q1) return p.setMessage(.at(wait.pane), "pipe: the selections overlap: the text is left as it was"); + return p.setMessage(wait.pane, std.fmt.bufPrint(&said, "pipe: {d} bytes of output in all, past {d}: the text is left as it was", .{ total_output, selection_pipe.max_total_stdout_bytes }) catch unreachable); // two numbers fit 128 + if (i > 0 and cut.lo < ops[i - 1].q1) return p.setMessage(wait.pane, "pipe: the selections overlap: the text is left as it was"); ops[i] = .{ .q0 = @intCast(cut.lo), .q1 = @intCast(cut.hi), .text = output }; } - const replacement = sam.apply(p.gpa, content, ops[0..n]) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + const replacement = sam.apply(p.gpa, content, ops[0..n]) catch |err| return p.reportError(wait.pane, "pipe", err); var new_ranges: [panes.Text.max_selections]modal.Selection = undefined; var delta: isize = 0; for (ops[0..n], wait.ranges[0..n], new_ranges[0..n]) |op, range, *moved| { @@ -316,10 +316,10 @@ pub fn pipeResponse( // One async request is one history transaction, even at 64 cursors. edit.pushUndo(p.editor(), t) catch |err| { p.gpa.free(replacement); - return p.reportError(.at(wait.pane), "pipe", err); + return p.reportError(wait.pane, "pipe", err); }; - edit.setEditText(p.editor(), t, replacement) catch |err| return p.reportError(.at(wait.pane), "pipe", err); - const now = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + edit.setEditText(p.editor(), t, replacement) catch |err| return p.reportError(wait.pane, "pipe", err); + const now = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(wait.pane, "pipe", err); t.setRanges(p.settings.tab, now, new_ranges[0..n], &.{}, wait.primary, wait.explicit); t.select = false; t.show(p.settings.tab); |
