summaryrefslogtreecommitdiff
path: root/core/Pipe.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 20:31:32 -0300
committerGabriel Schneider <[email protected]>2026-11-19 20:31:32 -0300
commit0db34fbf28e70c8c6a3c6025c0888fc5ec75201c (patch)
treef2e288668decded9276ebc45907f16d651b06f9e /core/Pipe.zig
parent2ab05b536bc3b063666b5aaab497157adc2a9120 (diff)
parentbf351b62e8843a3d173cedeefa2dd0b8ef4b4392 (diff)
downloadpardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.tar.gz
pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.zip
integration: a pane's and a view's slot as types, with the regular-expression fixes and the fixes the real loops asked for: pardes-ids (Pane.Id and View.Id through the entries, the events, the effects, the Host table and the device messages) and pardes-merge21, merged without a textual conflict; one call site written since on the old type follows (core/draw.zig: the twin test's file_changed event, .pane = .at(0)); tui core-test 848/991 (143 skipped), shell-test 1027/1030, the window builds; gates in the coordinator's ledger
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.zig30
1 files changed, 15 insertions, 15 deletions
diff --git a/core/Pipe.zig b/core/Pipe.zig
index 85329971..cf61b78f 100644
--- a/core/Pipe.zig
+++ b/core/Pipe.zig
@@ -95,7 +95,7 @@ pub fn submitPipe(p: *Pardes, id: usize) void {
const f = pane.file orelse return;
if (!panes.Output.fileTraits(f.output).saves) return;
}
- const content = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(id, "pipe", err);
+ const content = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(.at(id), "pipe", err);
const how = switch (pane.prompt) {
.pipe => |pipe| pipe,
else => return,
@@ -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(wait.pane, "pipe", err);
+ w.print("| {s}\n\n", .{wait.command}) catch |err| return p.reportError(.at(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(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);
+ 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);
const was = p.view().active;
panes.Output.openErrors(p, wait.pane, content) catch |err| {
p.gpa.free(content);
// Nowhere to put the report is itself worth one line.
- p.reportError(wait.pane, "pipe", err);
+ p.reportError(.at(wait.pane), "pipe", err);
return;
};
if (p.panes[was] != null) p.view().active = was;
@@ -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(wait.pane, "pipe", err);
+ const content = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(.at(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(wait.pane, "pipe", error.FileChangedWhileFiltering);
+ if (changed) return p.reportError(.at(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(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(.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
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(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");
+ 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");
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(wait.pane, "pipe", err);
+ const replacement = sam.apply(p.gpa, content, ops[0..n]) catch |err| return p.reportError(.at(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(wait.pane, "pipe", 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);
+ 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);
t.setRanges(p.settings.tab, now, new_ranges[0..n], &.{}, wait.primary, wait.explicit);
t.select = false;
t.show(p.settings.tab);