summaryrefslogtreecommitdiff
path: root/src/Core.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 02:07:32 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commit83b9d45b8665a80bdb70934aa23bbde5cc03d202 (patch)
treec902b557ef624b07cd139659d0a891cd4809e03e /src/Core.zig
parentb3d32656413734952bc918c2d4cfd12fede6c214 (diff)
downloadpardes-83b9d45b8665a80bdb70934aa23bbde5cc03d202.tar.gz
pardes-83b9d45b8665a80bdb70934aa23bbde5cc03d202.zip
plumber: a look sends what it looks at (docs/next-plumber.md, phase 2): after the pane's own readings and once a name already open in a pane is focused (never sent), lookAt sends the trimmed name, type text, src pardes (term from a raw terminal, a kind's name from its pane), wdir the pane's directory, with what resolveLookTarget found of it (Plumb.Seen: isfile and isdir take it, so no second stat and Look's own readings of a URL or `//` stay no file); a message the rules give back to `edit` as sent is Look's own (Sent.look) and runs lookAt's switch on that target, one nothing takes or a started word declines is Look's own too, whose `.url` arm is now the word's search; the edit port's open of another message runs with look_text, which now means "unplumbed", so the edit port's lookAt never sends again (the recursion trap); the three diff hooks become the default rules of the record's §5.2 (a bare .diff/.patch to `Diff $file`, a commit hash in the editor to `Diff $0`, after the two edit sets), and `Diff` takes a file or a revision, a rule's Diff declining in silence (Pardes.plumb_declined) where it cannot (no hunk, not readable, no .git above): hunks.lookedAt and lookedAtCommit go, their bodies in hunks.word, the `needs` check of the bare form in the word, PaneKind.diff gone; the old one-line `Plumb` word, Core.plumb, look.Port, plumbRuleError, plumbTarget and resolve's rules block go: bare, `Plumb` opens <config>/plumbing as Config opens init (both through builtins.openConfigFile; `include basic` in a new one), an argument is refused in words, Save applies it (host_io.writeFile beside reapplyInitFile, Plumb.saved), and boot reads it (Plumb.boot in applyStartupConfig); a started program now runs detached as Plan 9's plumber's (the coordinator's decision for the user's question 4): Effect.start, every host's host_io.startDetached (double fork, setsid, /dev/null for 0-2, every other fd closed, argv exec'd in wdir with no shell, the child's errno back through a close-on-exec pipe, said as `plumb start: <prog>: <why>`), so exec_dir goes; resolveLookTarget's and Plumb.Send.search's directory walk is one look.Dirs; test: look.zig's Plumb test rewritten onto the rules (a rule's word, an open pane unsent, the hover's resolve, a URL with no web rule searched for) and a hash inside and outside a git work tree; addons.zig's Plumb test onto plumb/rules (a port no kind reads, its kind gone: Look's own); Plumb.zig: the word, the save and boot; replicas.zig gains a URL (speculated whole, confirmed, no rollback) and a hash, each the authority's and a replica's own; every look golden unchanged; the reference quotes src/plumbing whole and says the order, the changelog says so
Diffstat (limited to 'src/Core.zig')
-rw-r--r--src/Core.zig20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/Core.zig b/src/Core.zig
index 9a6e80d4..9e404f2b 100644
--- a/src/Core.zig
+++ b/src/Core.zig
@@ -209,9 +209,6 @@ db: Db = .{},
/// (`stdio.h`, `<foo.h>`) is tried in, in order. The session's, seeded
/// with C's (/usr/include, /usr/local/include), kept in a dump.
incl: std.ArrayList([]u8) = .empty,
-/// Plumb's rules, the user's, tried in order before the built-in ones
-/// (look.resolve), the first to match taking the look. Kept in a dump.
-plumb: std.ArrayList([]u8) = .empty,
/// The plumber's rules (Plumb.zig): plumb/rules and plumb/send's, the
/// defaults (`include basic`) until something writes others. Kept in a dump.
plumber: Plumb = .{},
@@ -231,9 +228,11 @@ next_serial: u32 = 0,
/// The column whose tag the running command came from, while it runs:
/// the column acme's commands take from their Text's col.
exec_column: ?usize = null,
-/// The directory a `plumb start`'s command runs in, while it runs
-/// (Plumb.run): the message's wdir, which no pane need have.
-exec_dir: ?[]const u8 = null,
+/// While a word a plumbing rule started runs (Plumb.run): whether it
+/// declined the message, saying nothing (Diff on a file with no hunk, a
+/// revision outside a git work tree), so that the send is refused and a
+/// look looks itself. Null while no rule's word runs.
+plumb_declined: ?bool = null,
/// Panes made this step that found no room in their column
/// (layout.placeNew): closed at the step's end, once whatever made them
/// is done with them.
@@ -274,8 +273,10 @@ unattended: bool = false,
haptic: HapticSlot = if (platform == .macos) .none else {},
/// The look just run found nothing (look.zig missed).
look_missed: bool = false,
-/// The look being run opens a .diff or .patch as text, not its +Diff:
-/// Diff going back from a +Diff, Edit's B (it edits the file).
+/// The look being run opens what it names, unplumbed (Plumb.zig): a
+/// .diff as text, not stacked in a +Diff (Diff going back from a +Diff,
+/// Edit's B, which edits the file), and the `edit` port's open of a
+/// message the plumber already matched.
look_text: bool = false,
look_hover_wait: ?look.LookHoverWait = null,
/// The place a look-hover last found nothing to open: the pointer
@@ -764,8 +765,6 @@ pub fn deinit(p: *Pardes) void {
p.recent.deinit(p.recentGpa());
for (p.incl.items) |dir| p.gpa.free(dir);
p.incl.deinit(p.gpa);
- for (p.plumb.items) |rule| p.gpa.free(rule);
- p.plumb.deinit(p.gpa);
p.plumber.deinit(p.gpa);
for (p.twin_groups.items) |group| p.gpa.free(group.path);
p.twin_groups.deinit(p.gpa);
@@ -1711,7 +1710,6 @@ fn processDir(buf: *[limits.host_path_cap]u8) ?[]const u8 {
/// The directory a word run from pane `id`'s text or tag runs in, or,
/// from a header, the session's.
pub fn execDir(p: *Pardes, id: usize) []const u8 {
- if (p.exec_dir) |dir| return dir;
if (p.exec_header) return p.sessionDir();
return paneDir(p.panes[id] orelse return p.sessionDir());
}