From 0a75f3f333e795e741c83c1193e3b833d40caf46 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 02:44:25 -0300 Subject: plumber: the pager sends (docs/next-plumber.md, phase 4): a +Pager filled with a diff (File.looksLikeDiff, pager_diff) is a plumbing message, as acme's `plumb -i` sends what it shows: fillPager's last call is Plumb.paged, which sends src pager, dst edit, wdir the +Pager's directory, type text/x-diff, `action=showdata filename=` (quoted as mesg.c quotes), the text as data; the default rules' last set makes it showdiff (attr delete action, attr add action=showdiff, plumb to edit), and the edit port's showdata and showdiff (Plumb.show, acme's plumbshow) show the data in the pane filename names, the sender's own first, else a new clean pane of that name, showdiff then restacking it in a +Diff in its place (hunks.paged, the code the pager's hook called, unchanged); text paged that is no diff is not sent, where the record had every page sent: the look rules would read it whole, `type is text` holding (a `matches` over a MiB of output, up to the regular expressions' 300 ms budget, at each page), and a page of one line naming a file would ask the disk; the rules in force are read once and kept until their text changes (Plumb.parsed, by its hash, derived state: each process's own), measured in a fast build per send: 29k instructions to read the default rules, a URL's send 37k before, 8.3k after, a word's look 69k before, 40k after, a look that opens a file 262k before (its send 63k), 233k after (34k); test: a diff paged is stacked by the default rule, text that is no diff stays a +Pager, without the rule the +Pager stays as text, and another sender's showdata and showdiff; the design record gains what phases 2-4 did otherwise (detached starts with no output kept, only diffs paged sent, own ports asking nobody, the rules read once); plumber.zig's defaults end with the paged rule; the reference, the default rules' file and the changelog say so --- src/hunks.zig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/hunks.zig') diff --git a/src/hunks.zig b/src/hunks.zig index f316fe48..2fa86ccd 100644 --- a/src/hunks.zig +++ b/src/hunks.zig @@ -601,10 +601,10 @@ fn trimmedWidth(section: []const u8) usize { // ---- the +Diff in the editor ---- // -// Its word (Diff), the open and the text it goes back to; and the hook -// ninep/ctl.zig's filled +Pager calls, which the pager's plumbing message -// replaces. A bare look at a .diff and at a commit hash are plumbing -// rules that start Diff (src/plumbing). +// Its word (Diff), the open and the text it goes back to, and the +// restack of a paged diff. A bare look at a .diff, a commit hash and a +// paged diff are plumbing rules (src/plumbing) that start Diff or ask the +// edit port to show the diff (Plumb.show). /// The `Diff` word (builtins.zig registers it). Bare, on a +Diff, the diff /// it stacks as text; on a diff, its hunks stacked in a +Diff. With a file @@ -674,10 +674,10 @@ fn shows(pane: *const Pane) bool { return pane.colorAlgo() == .diff or (f.output != null and std.meta.eql(f.output.?.from, Output.Origin{ .cmd = .Diff })); } -/// The hook of a +Pager filled with a diff (ninep/ctl.zig's fillPager: -/// `git show`, difftui's patches): its hunks stacked in a +Diff in the -/// +Pager's place, the +Pager closed. The keyboard stays where it was, as -/// a page's. +/// A pane holding a diff (a +Pager filled with one: `git show`, difftui's +/// patches; the edit port's `showdiff`, Plumb.show): its hunks stacked in +/// a +Diff in its place, the pane closed. The keyboard stays where it was, +/// as a page's. pub fn paged(p: *Pardes, id: usize) void { const f = &p.panes[id].?.file.?; const keyboard = p.view().active; -- cgit v1.3