summaryrefslogtreecommitdiff
path: root/src/edit_cmd.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 11:40:11 -0300
committerGabriel Schneider <[email protected]>2026-11-05 12:41:36 -0300
commit3f1533813b6692a736251e4d467a7f108229ddee (patch)
tree37a32c5ebbf9d3af08923856fd6fa516f3b33a39 /src/edit_cmd.zig
parentcfd2b993feda1b3f7474225bb32db8cac8edc5ae (diff)
downloadpardes-3f1533813b6692a736251e4d467a7f108229ddee.tar.gz
pardes-3f1533813b6692a736251e4d467a7f108229ddee.zip
targets: the DOM web shell goes (src/web.zig and src/web/, its harnesses web_harness, web_snapshot, web_driver_test and web-snapshots/, tools/web_fixture.py, -Dplatform=web, -Ddump, and the web, web-harness, web-snap, web-e2e and web-driver-test steps), and with it what only a freestanding build needed: `hosted` and every guard on it (every build has a host now), memory's stack-fallback arenas and reduced_target sizes, the emscripten main, the tree-sitter libc shim and the stb stub, lsp's has_client, the web arms of the platform switches (-Dplatform is tui, gui or macos); the macOS files pass zig ast-check; docs/web.md is a paragraph on what it was
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/edit_cmd.zig')
-rw-r--r--src/edit_cmd.zig17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/edit_cmd.zig b/src/edit_cmd.zig
index 8bde605b..517f2e8d 100644
--- a/src/edit_cmd.zig
+++ b/src/edit_cmd.zig
@@ -76,7 +76,6 @@ const World = struct {
const f = ninep_pane.fileOf(pane) orelse continue;
if (std.mem.eql(u8, f.path, path)) return true;
}
- if (comptime !pardes.hosted) return true;
const local = filesystem.localPath(path) orelse return true;
if (@import("exec.zig").kindOf(local) == .directory) return said(bool, why, "B: {s} is a directory", .{path}) orelse false;
var buf: [4096]u8 = undefined;
@@ -93,7 +92,7 @@ const World = struct {
fn open(ctx: *anyopaque, path: []const u8, why: *sam.Why) ?sam.File {
const w: *World = @ptrCast(@alignCast(ctx));
const p = w.p;
- if (comptime pardes.hosted) if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(local) == .directory)
+ if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(local) == .directory)
return said(sam.File, why, "B: {s} is a directory", .{path});
// A look opens it, or finds it open, where a look would; the
// keyboard stays where the Edit ran.
@@ -113,7 +112,7 @@ const World = struct {
fn read(ctx: *anyopaque, arena: std.mem.Allocator, path: []const u8, why: *sam.Why) ?[]const u8 {
const w: *World = @ptrCast(@alignCast(ctx));
- if (comptime pardes.hosted) if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(local) == .directory)
+ if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(local) == .directory)
return said([]const u8, why, "{s} is a directory", .{path});
const bytes = filesystem.read(w.p, path) catch |err| {
// In the words Get says them (builtins.Get).
@@ -237,7 +236,7 @@ pub fn run(p: *Pardes, id: usize, command: []const u8) void {
.token = selection_pipe.newToken(),
// What a pane's command is given: $PARDES_MOUNT, $PARDES_9P,
// $PARDES_PID, $winid as the Edit's pane.
- .env = if (comptime pardes.hosted) @import("host_io.zig").commandEnv(arena, pane.serial, !p.opts.nested) catch &.{} else &.{},
+ .env = @import("host_io.zig").commandEnv(arena, pane.serial, !p.opts.nested) catch &.{},
};
keep = true;
p.pipe.edit_run = pd;
@@ -559,7 +558,6 @@ test "the held write asked again is parked again, then answered once, and a flus
}
test "Edit's < | and > with a real shell: a command per address, > printed to +Errors" {
- if (comptime !pardes.hosted) return error.SkipZigTest;
const p = try th.withFile(testing.allocator, "one two\nthree\n");
defer p.deinit();
const ctl = tree.Node.of(th.serialOf(p), .ctl);
@@ -580,7 +578,6 @@ test "Edit's < | and > with a real shell: a command per address, > printed to +E
}
test "a failing command changes nothing and says why, its stderr in +Errors" {
- if (comptime !pardes.hosted) return error.SkipZigTest;
const p = try th.withFile(testing.allocator, "keep\n");
defer p.deinit();
const ctl = tree.Node.of(th.serialOf(p), .ctl);
@@ -609,7 +606,7 @@ test "an Edit whose file is edited while its commands run is refused whole" {
}
test "X over open files, w, e, r, f, B and D on panes and the disk" {
- if (comptime !pardes.hosted or !filesystem.platform_has_fs) return error.SkipZigTest;
+ if (comptime !filesystem.platform_has_fs) return error.SkipZigTest;
const gpa = testing.allocator;
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
@@ -686,7 +683,7 @@ test "X over open files, w, e, r, f, B and D on panes and the disk" {
}
test "an Edit's w to a file changed on disk is refused once, as Save is, and the others are written" {
- if (comptime !pardes.hosted or !filesystem.platform_has_fs) return error.SkipZigTest;
+ if (comptime !filesystem.platform_has_fs) return error.SkipZigTest;
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = "a\n" });
@@ -722,7 +719,7 @@ test "an Edit's w to a file changed on disk is refused once, as Save is, and the
}
test "an Edit with no command runs beside one whose commands run, unless it touches what that one changes" {
- if (comptime !pardes.hosted or !filesystem.platform_has_fs) return error.SkipZigTest;
+ if (comptime !filesystem.platform_has_fs) return error.SkipZigTest;
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
try tmp.dir.writeFile(testing.io, .{ .sub_path = "other.txt", .data = "x\n" });
@@ -783,7 +780,7 @@ test "a session that ends while an Edit's commands run lets the Edit go" {
}
test "e and r say a file that cannot be read as Get says it" {
- if (comptime !pardes.hosted or !filesystem.platform_has_fs) return error.SkipZigTest;
+ if (comptime !filesystem.platform_has_fs) return error.SkipZigTest;
const p = try th.withFile(testing.allocator, "x\n");
defer p.deinit();
const ctl = tree.Node.of(th.serialOf(p), .ctl);