From 7c299a78d72274a2c101f5da0be4114f7c4dc4f3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:33:30 -0300 Subject: selection_pipe, Pipe, edit_cmd: a pipe's inputs are plain byte slices, not a one-field Input struct, dupeAll takes them concretely (no anytype, no length argument), and an Edit's request leaves the single command and cwd empty, which runJob never reads when every input has its own Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Pipe.zig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Pipe.zig') diff --git a/src/Pipe.zig b/src/Pipe.zig index f53a353d..af500665 100644 --- a/src/Pipe.zig +++ b/src/Pipe.zig @@ -74,7 +74,7 @@ pub const PendingPipe = struct { arena: std.heap.ArenaAllocator, command: []u8, cwd: []u8, - inputs: []selection_pipe.Input, + inputs: [][]const u8, ranges: [panes.Text.max_selections]modal.Selection, primary: u16, explicit: bool, @@ -120,13 +120,13 @@ pub fn submitPipe(p: *Pardes, id: usize) void { const ninputs = if (how.pipes()) got.n else 1; var arena_state: std.heap.ArenaAllocator = .init(p.gpa); const arena = arena_state.allocator(); - const inputs = arena.alloc(selection_pipe.Input, ninputs) catch return arena_state.deinit(); + const inputs = arena.alloc([]const u8, ninputs) catch return arena_state.deinit(); for (ranges[0..ninputs], inputs) |range, *input| { const lo = @min(range.anchor, range.head); const hi = @max(range.anchor, range.head); if (how.pipes() and hi > content.len) return arena_state.deinit(); const bytes = if (how.pipes()) content[lo..hi] else ""; - input.* = .{ .bytes = arena.dupe(u8, bytes) catch return arena_state.deinit() }; + input.* = arena.dupe(u8, bytes) catch return arena_state.deinit(); } // `$` wants a verdict per selection where the runner's is all or // nothing: the command runs in a subshell whose exit status becomes the @@ -346,7 +346,7 @@ test "selection pipe prompt submits exact request and Escape cancels" { try std.testing.expectEqualStrings("tr a-z A-Z", request.command); try std.testing.expectEqualStrings("/", request.cwd); try std.testing.expectEqual(@as(usize, 1), request.inputs.len); - try std.testing.expectEqualSlices(u8, "one", request.inputs[0].bytes); + try std.testing.expectEqualSlices(u8, "one", request.inputs[0]); const before = pane.file.?.content; p.update(.{ .key = .{ .cp = '|' } }); @@ -373,7 +373,7 @@ test "| in a tag pipes the tag's own text, and undo there brings it back" { const id = nextPipeEffect(p) orelse return error.MissingPipeEffect; const request = p.pipe.pipeRequest(id) orelse return error.MissingPipeRequest; try std.testing.expectEqual(@as(usize, 1), request.inputs.len); - try std.testing.expectEqualSlices(u8, "Save", request.inputs[0].bytes); + try std.testing.expectEqualSlices(u8, "Save", request.inputs[0]); const outputs: []const []const u8 = &.{"SAVE"}; p.update(.{ .pipe_resp = .{ .id = id, .success = true, .outputs = outputs } }); try std.testing.expect(std.mem.startsWith(u8, pardes.tagline.curTail(pane), " SAVE ")); @@ -437,8 +437,8 @@ test "selection pipe replaces all ranges atomically and undo restores them" { const id = nextPipeEffect(p) orelse return error.MissingPipeEffect; const request = p.pipe.pipeRequest(id) orelse return error.MissingPipeRequest; try std.testing.expectEqual(@as(usize, 2), request.inputs.len); - try std.testing.expectEqualSlices(u8, "aa", request.inputs[0].bytes); - try std.testing.expectEqualSlices(u8, "cc", request.inputs[1].bytes); + try std.testing.expectEqualSlices(u8, "aa", request.inputs[0]); + try std.testing.expectEqualSlices(u8, "cc", request.inputs[1]); var denied = std.testing.FailingAllocator.init(gpa, .{ .fail_index = 0 }); p.scratch.deinit(); @@ -510,7 +510,7 @@ test "a command with no stdin runs once and every cursor gets that one answer" { const request = p.pipe.pipeRequest(id) orelse return error.MissingPipeRequest; try std.testing.expectEqual(@as(usize, 1), request.inputs.len); - try std.testing.expectEqualSlices(u8, "", request.inputs[0].bytes); + try std.testing.expectEqualSlices(u8, "", request.inputs[0]); p.update(.{ .pipe_resp = .{ .id = id, .success = true, .outputs = &.{"T"} } }); try std.testing.expectEqualSlices(u8, "Taa bb Tcc\n", pane.file.?.content); -- cgit v1.3