summaryrefslogtreecommitdiff
path: root/src/selection_pipe.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-06 18:11:36 -0300
committerGabriel Schneider <[email protected]>2026-09-07 13:59:12 -0300
commit60367d8fe23f6af98ec28e3cf6c2094dfe332df0 (patch)
tree310fc734173cf771881f4691c71909135fadde97 /src/selection_pipe.zig
parentfa82cac885cb4738fe36d1e49b4749b5a3e31a4a (diff)
downloadpardes-60367d8fe23f6af98ec28e3cf6c2094dfe332df0.tar.gz
pardes-60367d8fe23f6af98ec28e3cf6c2094dfe332df0.zip
Refactor panes and filesystem; replace FUSE with 9P
Consolidate pane, layout, memory and host code. Serve 9P by default over Unix sockets, with runtime mounts and optional TCP/QUIC transports. Remove FUSE and obsolete proof-of-concept examples. Fix highlighting and terminal-history performance, expand differential and stress-test infrastructure, sort navigation results while preserving the next occurrence, add syntax-colored Braille minimaps, remove SPC-k, and document 9P interaction as a repository skill.
Diffstat (limited to 'src/selection_pipe.zig')
-rw-r--r--src/selection_pipe.zig26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/selection_pipe.zig b/src/selection_pipe.zig
index 8e721751..e1a42962 100644
--- a/src/selection_pipe.zig
+++ b/src/selection_pipe.zig
@@ -4,6 +4,7 @@
//! `runOne` on that worker. No subprocess or borrowed core memory reaches the
//! editor/event-loop thread.
const std = @import("std");
+const filesystem = @import("fs.zig");
/// A deliberately finite answer. One selection cannot retain more than 1 MiB
/// and a multi-selection command cannot retain more than 4 MiB in total.
@@ -43,7 +44,7 @@ pub const Job = struct {
.inputs = &.{},
};
errdefer gpa.free(job.command);
- job.cwd = try gpa.dupe(u8, request.cwd);
+ job.cwd = try gpa.dupe(u8, filesystem.localPath(request.cwd) orelse request.cwd);
errdefer gpa.free(job.cwd);
job.inputs = try gpa.alloc([]u8, request.inputs.len);
errdefer gpa.free(job.inputs);
@@ -325,6 +326,29 @@ pub fn runJob(gpa: std.mem.Allocator, io: std.Io, job: *const Job) Response {
return response;
}
+test "native selection filters use the physical directory of an explicit OS mount" {
+ const gpa = std.testing.allocator;
+ var tmp = std.testing.tmpDir(.{});
+ defer tmp.cleanup();
+ var directory_buf: [4096]u8 = undefined;
+ const directory = directory_buf[0..try tmp.dir.realPath(std.testing.io, &directory_buf)];
+ var declared_buf: [4102]u8 = undefined;
+ const declared = try std.fmt.bufPrint(&declared_buf, "/n/os{s}", .{directory});
+ const job = try Job.copy(gpa, .{ .id = 1, .command = "pwd", .cwd = declared, .inputs = &.{.{ .bytes = "" }} });
+ defer job.deinit(gpa);
+ try std.testing.expectEqualStrings(directory, job.cwd);
+ switch (runOne(gpa, std.testing.io, job.command, job.cwd, "")) {
+ .ok => |bytes| {
+ defer gpa.free(bytes);
+ try std.testing.expectEqualStrings(directory, std.mem.trimEnd(u8, bytes, "\n"));
+ },
+ .failed => |failure| {
+ gpa.free(failure.stderr);
+ return error.FilterFailed;
+ },
+ }
+}
+
test "native pipe runner preserves stdin/stdout bytes and reports how it failed" {
const gpa = std.testing.allocator;
const io = std.testing.io;