summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-27 22:30:58 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit52049344c1992850ea712e029eb5c4a88a7dfe19 (patch)
tree24d12755e9545470dda8021542299f0f72fd0baf /src/ninep
parent82551f77833a09b313bd3e58371582abd1aedcc4 (diff)
downloadpardes-52049344c1992850ea712e029eb5c4a88a7dfe19.tar.gz
pardes-52049344c1992850ea712e029eb5c4a88a7dfe19.zip
Move exec out of pardes.zig into exec.zig
Pure move, no behaviour change (acme keeps this in exec.c): execute, commandText, max_exec_depth, executeBuiltinLine, applyStartupConfig, runBuiltin and applySettingBuiltin; the getarg-style operand code (withArg, PointerOperand, pointerOperand, heldSelection, chordEachSel); takesCommandLine and the terminals commands run in (spawnTty, spawnV9fsTty, spawnTtyWithMount, evictLonePristineTty, replaceStillborn, ttyForDir); placeDoc; and the save path (submitSave, saveFile, saveTo, askWrite), with the acme-chords test, go verbatim to exec.zig. The methods become free functions taking `p: *Pardes`. executeBuiltinLine is called from ~170 places as `p.executeBuiltinLine(..)`, so Pardes keeps one declaration alias for it and those call sites stay; the other 104 calls change from `p.execute(..)` to `exec.execute(p, ..)`. ninep/ctl.zig has a local named exec, so it writes `pardes.exec.execute` instead of importing the file. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/ctl.zig2
-rw-r--r--src/ninep/events.zig3
-rw-r--r--src/ninep/pane.zig3
3 files changed, 5 insertions, 3 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 25fe4037..645b1c33 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -59,7 +59,7 @@ fn activeSerial(p: *Pardes) ?u32 {
fn run(p: *Pardes, id: usize, exec: bool, text: []const u8) void {
const context = p.panes[id].?.serial;
const before = Serials.snapshot(p);
- if (exec) _ = p.execute(id, text) else look.lookAt(p, id, text);
+ if (exec) _ = pardes.exec.execute(p, id, text) else look.lookAt(p, id, text);
const after = Serials.snapshot(p);
var created = false;
for (after.list[0..after.len]) |serial| if (!before.has(serial)) {
diff --git a/src/ninep/events.zig b/src/ninep/events.zig
index d4d7fcad..49e852b3 100644
--- a/src/ninep/events.zig
+++ b/src/ninep/events.zig
@@ -2,6 +2,7 @@
//! bounded queues that park a read until something happens.
const std = @import("std");
const pardes = @import("../pardes.zig");
+const exec = @import("../exec.zig");
const look = @import("../look.zig");
const tree = @import("tree.zig");
const pane_files = @import("pane.zig");
@@ -461,7 +462,7 @@ pub fn writeEvent(p: *Pardes, req: Req, id: usize) Reply {
const hi = @max(lo, @min(@as(usize, r.q1), whole.len));
const text = p.scratch.allocator().dupe(u8, whole[lo..hi]) catch continue;
switch (r.action) {
- .body_exec, .tag_exec => _ = p.execute(live, text),
+ .body_exec, .tag_exec => _ = exec.execute(p, live, text),
.body_look, .tag_look => look.lookAt(p, live, text),
else => unreachable,
}
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index 4110380a..76854dbc 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -3,6 +3,7 @@
//! mark and scroll, errors, event, look and exec. Terminals add pty/ (pty.zig).
const std = @import("std");
const pardes = @import("../pardes.zig");
+const exec = @import("../exec.zig");
const look = @import("../look.zig");
const panes = @import("../panes.zig");
const modal = @import("../modal.zig");
@@ -589,7 +590,7 @@ pub fn appendErrors(p: *Pardes, id: usize, text: []const u8) ?usize {
p.gpa.free(content);
return null;
};
- p.placeDoc(id, free, np);
+ exec.placeDoc(p, id, free, np);
return text.len;
}