From 1ca52fc338c4a862a50254420ecd60428dd32a6e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 15:02:36 -0300 Subject: build: the step lib-test is consumer-test (P37, ruled with the names): the step, its name and its two variables in build/tools.zig (lib_test, lib_test_step -> consumer_test, consumer_test_step; the description already says it builds the library from a package that depends on pardes) and the one reader in build/tests.zig, and where it is named: build.zig's head comment, test/consumer/build.zig's, docs/typ/building.typ (the paragraph and the steps' table) and the Unreleased entry of core/CHANGELOG.md that introduced the step (rewrapped); the scripts under .scratch that name it are listed in reports/pardes-slots.md for the coordinator; `zig build consumer-test -Dplatform=tui` builds and tests test/consumer; gate on the stack through this change and the docking vocabulary (load 4-32): tui core-test 871/1028 (157 skipped), shell-test 1070/1073, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, consumer-test passes, addon-test 5/5, process-test 0 of 144 (tty boot: msg failed once at load 32 and passed alone), replicas --clients 5 and --bytes --clients 5: diverged 0, unequal 0, deltas wrong 0, quiet checks differed 0, unlisted stops 0, corpus 22 of 22, no leak; the semantics word a73794ff9e03f814 as on merge40; daemon.py --far, --games, --window-clients pass, plain fails 2 of 4 at "client C agrees with a shell's output" (a timeout), as merge40's build does 3 of 6; the macOS library (x86_64-linux, aarch64-macos, the ABI guard 2/2) and the FreeBSD cross-build build; frames 77/77, gui unit-test 1666/1670 (the perf check's BaselineHarnessMismatch), perfab corpus2x +0.054% (noise 0.054%), the 121 per-operation counts within 0.1% against tree2 (key-down on medium 10,039,720 and render on medium 11,454,636, merge40's gate 10,039,703 and 11,454,619) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index faa02ade..b12d6988 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -238,9 +238,9 @@ editor has them, for a program that draws source text itself. Every dependency but tree-sitter's runtime is lazy in the manifest, so such a package fetches the runtime and the grammars of its `grammars` set - and nothing else; `zig build lib-test`, which `unit-test` runs, builds - one (`test/consumer`). The markdown grammar is pinned by its commit: its - branch has moved, and a fresh checkout could not fetch it. + and nothing else; `zig build consumer-test`, which `unit-test` runs, + builds one (`test/consumer`). The markdown grammar is pinned by its + commit: its branch has moved, and a fresh checkout could not fetch it. - Enter, `o` and `O` give the new line helix's indent where the file's grammar has an indent query (bash, C, C#, C++, Clojure, CSS, Elixir, -- cgit v1.3 From 4887578ce82518c84ef76f7ee03748911f4f9933 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 15:12:36 -0300 Subject: core: the fields that hold a pane's slot and hand it to the entries are Pane.Id (P21: the fields, not the inner code): Pipe.PendingPipe.pane (usize; authority only, in no dump or digest), the LSP question's wait.pane (usize; dumped and digested: a byte where it was eight), Pardes.theme_file_pane (u8: the same byte) and colors.ThemeFileRequest.pane (u8); the 14 `.at(wait.pane)`, 7 `.at(w.pane)` and 4 `.at(request.pane)`/`.at(pane)` go, lspResponse takes the integer once for its nine integer readers (`asked`), and requestThemeFile stores `.at(id)` where it clamped a slot it had just reported on by MAX_PANES - 1 (the clamp and colors.zig's MAX_PANES go); the conversions by count.py (.at(, .index(), @intCast of a slot) fall: the core's code 440 -> 427, dev's and runtime's 120 -> 116; the other fields that hold a slot are left, each read as an integer more often than it is wrapped (View.active about +216 by the estimate, builtins' Ctx.id +108; the table in reports/pardes-slots.md); the compiler caught nothing (every use read first); the semantics word does not move (a73794ff9e03f814); the dump's table gives both fields a new kind, so a session restored from an older build's dump says once "a dump of another build: Core.theme_file_pane: its kind changed; its default taken" (and a dump made mid-question drops the question); gate on the stack through this change and the docking vocabulary (load 4-32): tui core-test 871/1028 (157 skipped), shell-test 1070/1073, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, consumer-test passes, addon-test 5/5, process-test 0 of 144 (tty boot: msg failed once at load 32 and passed alone), replicas --clients 5 and --bytes --clients 5: diverged 0, unequal 0, deltas wrong 0, quiet checks differed 0, unlisted stops 0, corpus 22 of 22, no leak; the semantics word a73794ff9e03f814 as on merge40; daemon.py --far, --games, --window-clients pass, plain fails 2 of 4 at "client C agrees with a shell's output" (a timeout), as merge40's build does 3 of 6; the macOS library (x86_64-linux, aarch64-macos, the ABI guard 2/2) and the FreeBSD cross-build build; frames 77/77, gui unit-test 1666/1670 (the perf check's BaselineHarnessMismatch), perfab corpus2x +0.054% (noise 0.054%), the 121 per-operation counts within 0.1% against tree2 (key-down on medium 10,039,720 and render on medium 11,454,636, merge40's gate 10,039,703 and 11,454,619) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/Core.zig | 2 +- core/Pipe.zig | 36 ++++++++++++++++++------------------ core/colors.zig | 7 +++---- core/lsp/Ask.zig | 39 ++++++++++++++++++++------------------- dev/file_watch.zig | 6 +++--- runtime/macos.zig | 2 +- 6 files changed, 46 insertions(+), 46 deletions(-) (limited to 'core') diff --git a/core/Core.zig b/core/Core.zig index ff704bc6..7c20c252 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -300,7 +300,7 @@ theme_file_path: config.Settings.Text(limits.host_path_cap) = .{}, /// what a failed ThemeFile goes back to (colors.revertThemeFile). theme_file_loaded: config.Settings.Text(limits.host_path_cap) = .{}, theme_file_generation: u32 = 0, -theme_file_pane: u8 = 0, +theme_file_pane: Pane.Id = .at(0), chrome: colors.ChromeTheme = colors.initial_chrome, /// Every drawn frame's timings (FrameStats: the Debug box, PARDES_FRAMES): /// its runner's (`Options.frames`), which its frontend writes as it draws diff --git a/core/Pipe.zig b/core/Pipe.zig index cf61b78f..012ce689 100644 --- a/core/Pipe.zig +++ b/core/Pipe.zig @@ -52,7 +52,7 @@ pub const PendingPipe = struct { /// The digest's walk (core/walk.zig) of the ranges, as far as they go. pub const replica = .{ .len = .{.{ "ranges", "nranges" }} }; id: u32, - pane: usize, + pane: Pane.Id, serial: u32, /// The text piped: the pane's body or tag, or a header (`column` /// names which). @@ -133,7 +133,7 @@ pub fn submitPipe(p: *Pardes, id: usize) void { if (p.pipe.wait) |*old| old.deinit(); p.pipe.wait = .{ .id = p.pipe.seq, - .pane = id, + .pane = .at(id), .serial = pane.serial, .what = t.what, .column = p.headerColumn() orelse 0, @@ -166,16 +166,16 @@ fn pipeFailed(p: *Pardes, wait: *const PendingPipe, failure: ?selection_pipe.Fai var out: std.Io.Writer.Allocating = .init(p.gpa); defer out.deinit(); const w = &out.writer; - w.print("| {s}\n\n", .{wait.command}) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + w.print("| {s}\n\n", .{wait.command}) catch |err| return p.reportError(wait.pane, "pipe", err); if (wait.inputs.len > 1) if (failure) |fail| - w.print("selection {d} of {d}: ", .{ fail.index + 1, wait.inputs.len }) catch |err| return p.reportError(.at(wait.pane), "pipe", err); - writeFailure(w, failure) catch |err| return p.reportError(.at(wait.pane), "pipe", err); - const content = out.toOwnedSlice() catch |err| return p.reportError(.at(wait.pane), "pipe", err); + w.print("selection {d} of {d}: ", .{ fail.index + 1, wait.inputs.len }) catch |err| return p.reportError(wait.pane, "pipe", err); + writeFailure(w, failure) catch |err| return p.reportError(wait.pane, "pipe", err); + const content = out.toOwnedSlice() catch |err| return p.reportError(wait.pane, "pipe", err); const was = p.view().active; - panes.Output.openErrors(p, wait.pane, content) catch |err| { + panes.Output.openErrors(p, wait.pane.index(), content) catch |err| { p.gpa.free(content); // Nowhere to put the report is itself worth one line. - p.reportError(.at(wait.pane), "pipe", err); + p.reportError(wait.pane, "pipe", err); return; }; if (p.panes[was] != null) p.view().active = was; @@ -250,7 +250,7 @@ pub fn pipeResponse( if (!success or outputs.len != wait.inputs.len) return pipeFailed(p, &wait, failure); - const pane = p.panes[wait.pane] orelse return; + const pane = p.panes[wait.pane.index()] orelse return; if (pane.serial != wait.serial) return; const t: *Text = switch (wait.what) { .body => &pane.body, @@ -259,13 +259,13 @@ pub fn pipeResponse( .workspace => &p.global_tag, .input => return, }; - const content = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + const content = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(wait.pane, "pipe", err); const changed = if (t.what == .body) changed: { const f = pane.file orelse return; if (!panes.Output.fileTraits(f.output).saves) return; break :changed f.revision != wait.revision; } else std.hash.Wyhash.hash(0, content) != wait.sum; - if (changed) return p.reportError(.at(wait.pane), "pipe", error.FileChangedWhileFiltering); + if (changed) return p.reportError(wait.pane, "pipe", error.FileChangedWhileFiltering); if (wait.how == .ignore) return; if (wait.how == .keep) { @@ -296,14 +296,14 @@ pub fn pipeResponse( const cut = pipeCut(&wait, content, i) orelse return; const output = pipeOutput(&wait, outputs, content, i); if (output.len > selection_pipe.max_stdout_bytes) - return p.setMessage(.at(wait.pane), std.fmt.bufPrint(&said, "pipe: an output of {d} bytes, past {d}: the text is left as it was", .{ output.len, selection_pipe.max_stdout_bytes }) catch unreachable); // two numbers fit 128 + return p.setMessage(wait.pane, std.fmt.bufPrint(&said, "pipe: an output of {d} bytes, past {d}: the text is left as it was", .{ output.len, selection_pipe.max_stdout_bytes }) catch unreachable); // two numbers fit 128 total_output += output.len; // each under 1 MiB, at most max_selections of them if (total_output > selection_pipe.max_total_stdout_bytes) - return p.setMessage(.at(wait.pane), std.fmt.bufPrint(&said, "pipe: {d} bytes of output in all, past {d}: the text is left as it was", .{ total_output, selection_pipe.max_total_stdout_bytes }) catch unreachable); // two numbers fit 128 - if (i > 0 and cut.lo < ops[i - 1].q1) return p.setMessage(.at(wait.pane), "pipe: the selections overlap: the text is left as it was"); + return p.setMessage(wait.pane, std.fmt.bufPrint(&said, "pipe: {d} bytes of output in all, past {d}: the text is left as it was", .{ total_output, selection_pipe.max_total_stdout_bytes }) catch unreachable); // two numbers fit 128 + if (i > 0 and cut.lo < ops[i - 1].q1) return p.setMessage(wait.pane, "pipe: the selections overlap: the text is left as it was"); ops[i] = .{ .q0 = @intCast(cut.lo), .q1 = @intCast(cut.hi), .text = output }; } - const replacement = sam.apply(p.gpa, content, ops[0..n]) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + const replacement = sam.apply(p.gpa, content, ops[0..n]) catch |err| return p.reportError(wait.pane, "pipe", err); var new_ranges: [panes.Text.max_selections]modal.Selection = undefined; var delta: isize = 0; for (ops[0..n], wait.ranges[0..n], new_ranges[0..n]) |op, range, *moved| { @@ -316,10 +316,10 @@ pub fn pipeResponse( // One async request is one history transaction, even at 64 cursors. edit.pushUndo(p.editor(), t) catch |err| { p.gpa.free(replacement); - return p.reportError(.at(wait.pane), "pipe", err); + return p.reportError(wait.pane, "pipe", err); }; - edit.setEditText(p.editor(), t, replacement) catch |err| return p.reportError(.at(wait.pane), "pipe", err); - const now = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(.at(wait.pane), "pipe", err); + edit.setEditText(p.editor(), t, replacement) catch |err| return p.reportError(wait.pane, "pipe", err); + const now = edit.flatSurface(p.editor(), t) catch |err| return p.reportError(wait.pane, "pipe", err); t.setRanges(p.settings.tab, now, new_ranges[0..n], &.{}, wait.primary, wait.explicit); t.select = false; t.show(p.settings.tab); diff --git a/core/colors.zig b/core/colors.zig index 4825ea3f..7e692fe5 100644 --- a/core/colors.zig +++ b/core/colors.zig @@ -8,7 +8,6 @@ const Color = @import("surface.zig").Color; const FontRole = @import("surface.zig").FontRole; const config = @import("config.zig"); const platform = pardes.platform; -const MAX_PANES = pardes.MAX_PANES; const BOX_H = pardes.BOX_H; const Pardes = pardes.Pardes; @@ -630,7 +629,7 @@ pub fn requestThemeFile(p: *Pardes, id: usize, argument: []const u8) void { p.reportError(.at(id), "theme file", error.PathTooLong); return; } - p.theme_file_pane = @intCast(@min(id, MAX_PANES - 1)); + p.theme_file_pane = .at(id); const generation = nextThemeFileGeneration(p); p.emit(.{ .theme_file = .{ .generation = generation, .on = true } }); } @@ -645,7 +644,7 @@ pub fn loadedThemeFile(p: *const Pardes) ?[]const u8 { pub const ThemeFileRequest = struct { path: []const u8, - pane: u8, + pane: pardes.Pane.Id, }; /// Borrow the current request while a native host performs its synchronous @@ -673,7 +672,7 @@ fn themeFileFailure(p: *Pardes, request: ThemeFileRequest, why: []const u8) void var said: pardes.Kind.Buf(520) = .{}; var cut: [200]u8 = undefined; const path = @import("ninep/tree.zig").fitErr(request.path, &cut); - p.reportFailure(request.pane, said.print("theme file {s}: {s}", .{ path, why })); + p.reportFailure(request.pane.index(), said.print("theme file {s}: {s}", .{ path, why })); revertThemeFile(p); } diff --git a/core/lsp/Ask.zig b/core/lsp/Ask.zig index 376b093d..500f02b5 100644 --- a/core/lsp/Ask.zig +++ b/core/lsp/Ask.zig @@ -29,7 +29,7 @@ last: ?struct { kind: lsp.Kind, arg: Effect.Buf(128), serial: u32, offset: u32 } wait: ?struct { id: u32, kind: lsp.Kind, - pane: usize, + pane: Pane.Id, serial: u32, revision: u32, arg: Effect.Buf(128), @@ -103,7 +103,7 @@ pub fn lspRequest(p: *Pardes, asked: usize, kind: lsp.Kind, arg_in: []const u8) p.lsp_ask.wait = .{ .id = p.lsp_ask.seq, .kind = kind, - .pane = id, + .pane = .at(id), .serial = pane.serial, .revision = if (pane.file) |f| f.revision else 0, .arg = .from(arg), @@ -270,24 +270,25 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { const w = p.lsp_ask.wait orelse return; if (w.id != id) return; // superseded by a newer press, or the pane died p.lsp_ask.wait = null; - const pane = p.panes[w.pane] orelse return; + const asked = w.pane.index(); + const pane = p.panes[asked] orelse return; if (pane.serial != w.serial) return; // Whatever fails from here -- no answer, nothing found, no room for // its pane -- fails a 9P write that asked it too. const failures = p.fs.failures; - defer if (p.fs.failures != failures) p.noteLateFailure(.at(w.pane)); + defer if (p.fs.failures != failures) p.noteLateFailure(w.pane); var said: pardes.Kind.Buf(256) = .{}; const rows = response orelse - return p.reportFailure(w.pane, said.print("{s}: the language server did not answer", .{lspWord(w.kind)})); + return p.reportFailure(asked, said.print("{s}: the language server did not answer", .{lspWord(w.kind)})); // A backend that cannot answer it says why (`@none `). if (std.mem.startsWith(u8, rows, "@none ")) { const why = std.mem.trimEnd(u8, rows["@none ".len..], "\n"); - return p.reportFailure(w.pane, said.print("{s}: {s}", .{ lspWord(w.kind), why })); + return p.reportFailure(asked, said.print("{s}: {s}", .{ lspWord(w.kind), why })); } // Index's answer is its indexer's command line, run in a command // pane (lsp_client.indexCommand). if (w.kind == .index) { - if (std.mem.startsWith(u8, rows, "@run ")) _ = exec.execute(p, w.pane, std.mem.trimEnd(u8, rows["@run ".len..], "\n")); + if (std.mem.startsWith(u8, rows, "@run ")) _ = exec.execute(p, asked, std.mem.trimEnd(u8, rows["@run ".len..], "\n")); return; } if (w.kind == .rename or w.kind == .format) { @@ -296,7 +297,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { if (applyLspEdits(p, pane, w.revision, edits)) { var buf: pardes.Kind.Buf(64) = .{}; const verb: []const u8 = if (w.kind == .rename) "renamed" else "formatted"; - p.setMessage(.at(w.pane), buf.print("{s} {d} range(s)", .{ verb, edits.len })); + p.setMessage(w.pane, buf.print("{s} {d} range(s)", .{ verb, edits.len })); } return; } @@ -308,19 +309,19 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { } if (rows.len == 0) { if (w.kind == .completion and pane.body.mode == .insert and pane.body.nsel == 0 and - pane.body.cur_row == w.row and pane.body.cur_col == w.col) edit.insertTab(p.editor(), &pane.body) catch |err| return p.reportError(.at(w.pane), "complete", err); + pane.body.cur_row == w.row and pane.body.cur_col == w.col) edit.insertTab(p.editor(), &pane.body) catch |err| return p.reportError(w.pane, "complete", err); // Nothing found fails, but for a file with no diagnostics, // which is no failure, and a completion's Tab. const none: ?[]const u8 = switch (w.kind) { .completion, .format => null, .rename => "nothing here to rename", - .diagnostics, .workspace_diagnostics => return p.setMessage(.at(w.pane), said.print("{s}: none", .{lspWord(w.kind)})), + .diagnostics, .workspace_diagnostics => return p.setMessage(w.pane, said.print("{s}: none", .{lspWord(w.kind)})), .incoming_calls => "callers not found", .outgoing_calls => "callees not found", .hover => "nothing to show: not found", else => "not found", }; - if (none) |text| p.reportFailure(w.pane, said.print("{s}: {s}", .{ lspWord(w.kind), text })); + if (none) |text| p.reportFailure(asked, said.print("{s}: {s}", .{ lspWord(w.kind), text })); return; } @@ -330,7 +331,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { const ln = std.mem.trimEnd(u8, rows, "\n"); const place = ln[0..panes.Output.location(ln).end]; p.look_missed = false; - look.lookAt(p, w.pane, place); + look.lookAt(p, asked, place); // The one place is the text's places, as a list's would be: tinted, // and n and N step it. const spot = look.parsePathLine(place); @@ -367,16 +368,16 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { }; if (listed) |source| if (pane.file != null and pane.query == null and !p.exec_header) { p.fs.refilled = null; - panes.Query.fillList(p, w.pane, source, rows); + panes.Query.fillList(p, asked, source, rows); p.fs.lsp_result = if (panes.Query.ofOwner(p, pane.serial)) |qid| p.panes[qid].?.serial else null; return; }; const dir = if (pane.file) |f| panes.Dir.ofName(f.path) else pane.cwdSlice(); - const content = p.gpa.dupe(u8, rows) catch |err| return p.reportError(.at(w.pane), lspWord(w.kind), err); + const content = p.gpa.dupe(u8, rows) catch |err| return p.reportError(w.pane, lspWord(w.kind), err); const serial_before = p.next_serial; p.fs.refilled = null; - panes.Output.fillResults(p, w.pane, dir, from, w.arg.slice(), content, null) catch |err| { - p.reportError(.at(w.pane), "language response", err); + panes.Output.fillResults(p, asked, dir, from, w.arg.slice(), content, null) catch |err| { + p.reportError(w.pane, "language response", err); return; }; if (rows.len >= 1 << 20) memory.trim(); @@ -390,7 +391,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { if (p.next_serial != serial_before) { const report_rows = std.mem.count(u8, result_pane.file.?.content, "\n"); const wanted: u16 = @intCast(@min(v.screen_h, report_rows + result_pane.tag_rows)); - layout.givePaneRows(p, result_id, wanted, w.pane); + layout.givePaneRows(p, result_id, wanted, asked); } look.focusPaneLine(p, result_id, .{ .line = 1, .col = 1 }, .keep); break; @@ -401,7 +402,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { // Rows that only name a file the server left alone (lsp_client // renameEdits) are no edits. const unrenamed = std.mem.count(u8, rows, ", which the server did not rename\n"); - p.setMessage(.at(w.pane), if (unrenamed > 0) + p.setMessage(w.pane, if (unrenamed > 0) said_buf.print("Rename: previewed, not applied: the server renamed in this file only, and {d} other open file(s) say the name", .{unrenamed}) else said_buf.print("Rename: {d} edit(s) across files, previewed, not applied", .{nrows})); @@ -413,7 +414,7 @@ pub fn lspResponse(p: *Pardes, id: u32, response: ?[]const u8) void { .line = @as(usize, @intCast(@max(0, w.row))) + 1, .col = @as(usize, @intCast(@max(0, w.col))) + 1, }); - _ = look.jumpResult(p, w.pane, row); + _ = look.jumpResult(p, asked, row); } } diff --git a/dev/file_watch.zig b/dev/file_watch.zig index c575f436..a0a500d7 100644 --- a/dev/file_watch.zig +++ b/dev/file_watch.zig @@ -611,12 +611,12 @@ pub fn applyThemeEffect( const pane = request.pane; const bytes = filesystem.readFile(&pardes.tape.none, gpa, request.path) catch |err| { colors.failThemeFile(core, generation, err); - core.noteLateFailure(.at(pane)); + core.noteLateFailure(pane); return false; }; defer gpa.free(bytes); if (!colors.loadThemeFile(core, generation, bytes)) { - core.noteLateFailure(.at(pane)); + core.noteLateFailure(pane); return false; } const hash = std.hash.Wyhash.hash(0, bytes); @@ -659,7 +659,7 @@ pub fn reloadTheme( live.generation = .{ .text = hash }; if (announce) { var msg_buf: [256]u8 = undefined; - core.setMessage(.at(request.pane), message.stamp(&msg_buf, "reloaded theme", request.path)); + core.setMessage(request.pane, message.stamp(&msg_buf, "reloaded theme", request.path)); } return false; } diff --git a/runtime/macos.zig b/runtime/macos.zig index 1954cfa5..88eab2bb 100644 --- a/runtime/macos.zig +++ b/runtime/macos.zig @@ -683,7 +683,7 @@ fn reloadWatchedTheme(st: *State, announce: bool) bool { live.retries_left = 0; if (announce) { var mbuf: [256]u8 = undefined; - st.core.setMessage(.at(request.pane), message.stamp(&mbuf, "reloaded theme", request.path)); + st.core.setMessage(request.pane, message.stamp(&mbuf, "reloaded theme", request.path)); } return true; } -- cgit v1.3 From e9a641ee2c743fec2fe2505d2e11c96fa36767b8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 15:13:18 -0300 Subject: core, docs: the docking vocabulary, the family the rename of attached_to to docked_to left (P37): layout.attachFrom -> layout.dockFrom (its five callers: Query.zig x2, Store.zig, its tests), testAttachment -> testDocking, Query.zig's local attached -> docked, the section "Attached panes" -> "Docked panes" (and the three comments that name it), and "attached", "attachment(s)", "unattached", "Attach new pane", "detaches it" where a pane is docked to a pane -> "docked", "docked pane(s)", "undocked", "Dock new pane", "undocks it", through core/layout.zig (two test names with it), core/Handover.zig, core/Store.zig, core/Query.zig, comments in core/panes.zig (4) and core/builtins.zig (2), docs/next-drag.md, docs/search-proto-converge.md and docs/next-daemon.md (1); every attach of a client to a session stays, as do the search prototype's name "attached" and its setting SearchPlace attached|column (docs/search-proto-converge.md:18, :134: names of the past) and the changelog's past entries; no behaviour changes; gate on the stack through this change and the docking vocabulary (load 4-32): tui core-test 871/1028 (157 skipped), shell-test 1070/1073, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, consumer-test passes, addon-test 5/5, process-test 0 of 144 (tty boot: msg failed once at load 32 and passed alone), replicas --clients 5 and --bytes --clients 5: diverged 0, unequal 0, deltas wrong 0, quiet checks differed 0, unlisted stops 0, corpus 22 of 22, no leak; the semantics word a73794ff9e03f814 as on merge40; daemon.py --far, --games, --window-clients pass, plain fails 2 of 4 at "client C agrees with a shell's output" (a timeout), as merge40's build does 3 of 6; the macOS library (x86_64-linux, aarch64-macos, the ABI guard 2/2) and the FreeBSD cross-build build; frames 77/77, gui unit-test 1666/1670 (the perf check's BaselineHarnessMismatch), perfab corpus2x +0.054% (noise 0.054%), the 121 per-operation counts within 0.1% against tree2 (key-down on medium 10,039,720 and render on medium 11,454,636, merge40's gate 10,039,703 and 11,454,619) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/Handover.zig | 14 +++---- core/Query.zig | 18 ++++----- core/Store.zig | 8 ++-- core/builtins.zig | 4 +- core/layout.zig | 90 +++++++++++++++++++++---------------------- core/panes.zig | 8 ++-- docs/next-daemon.md | 2 +- docs/next-drag.md | 6 +-- docs/search-proto-converge.md | 8 ++-- 9 files changed, 79 insertions(+), 79 deletions(-) (limited to 'core') diff --git a/core/Handover.zig b/core/Handover.zig index dde31f8b..6f7340b2 100644 --- a/core/Handover.zig +++ b/core/Handover.zig @@ -33,7 +33,7 @@ const MAX_PANES = pardes.MAX_PANES; /// libc: fork and exec of a window, and file calls in the cancelable carry task that must not see its cancel (its defer's unlink). const libc = std.c; -/// What a grip carries out of its window: one pane with the panes attached +/// What a grip carries out of its window: one pane with the panes docked /// to it, or a whole column. pub const Kind = enum { pane, column }; @@ -46,7 +46,7 @@ const Carried = struct { /// Each pane as dump.savePane makes it, top to bottom. panes: []const []const u8, weights: []const f32, - /// Which of them each one is attached to (layout.zig, "Attached panes"). + /// Which of them each one is docked to (layout.zig, "Docked panes"). owners: []const ?u32, }; pub const carried_magic = "pardes-carried\n"; @@ -84,8 +84,8 @@ pub fn deinit(h: *Handover, gpa: std.mem.Allocator) void { h.bytes = null; } -/// Pane slot `at` (with what is attached to it, or alone when it is itself -/// an attachment), or column `at`, released past the window's edge: dumped, +/// Pane slot `at` (with what is docked to it, or alone when it is itself +/// a docked pane), or column `at`, released past the window's edge: dumped, /// and the host asked to carry it. Only text panes travel: a terminal's /// shell is this process's child and would die with the pane here. pub fn begin(h: *Handover, p: *Pardes, carried: Kind, at: usize) void { @@ -273,7 +273,7 @@ pub fn adopt(p: *Pardes, bytes: []const u8) !usize { n += 1; if (pane.file == null) return error.NotText; } - // An attachment names its owner by its place in the dump. + // A docked pane names its owner by its place in the dump. for (st.owners, 0..) |owner, k| { const at = owner orelse continue; if (at >= n) continue; @@ -299,7 +299,7 @@ pub fn adopt(p: *Pardes, bytes: []const u8) !usize { for (0..p.view().ncol) |c| for (p.view().cols[c].panes[0..p.view().cols[c].n]) |id| { heights[id] = p.view().rects[id].h; }; - // The group under the pointer (a pane with what is attached to it): the + // The group under the pointer (a pane with what is docked to it): the // new panes go under all of it, out of its owner's rows. var after: usize = p.view().cols[tc].n; var root: ?usize = null; @@ -315,7 +315,7 @@ pub fn adopt(p: *Pardes, bytes: []const u8) !usize { } if (root) |owner| { const r = p.view().rects[owner]; - // Down to the pointer's row; let go over one of its attachments, + // Down to the pointer's row; let go over one of its docked panes, // half of it. const keeps = @max(layout.minRows(p, owner), if (y >= r.y and y < r.y + r.h) (y - r.y) + 1 else r.h / 2); const give = heights[owner] -| keeps; diff --git a/core/Query.zig b/core/Query.zig index ebb44155..95322cc1 100644 --- a/core/Query.zig +++ b/core/Query.zig @@ -1,5 +1,5 @@ -//! The query pane: the one pane search is. A +Search attached under the -//! pane that asked (its owner, layout.zig "Attached panes"), born at a +//! The query pane: the one pane search is. A +Search docked under the +//! pane that asked (its owner, layout.zig "Docked panes"), born at a //! fixed height, whose body's line 1 is the query, editable text, and //! whose rows below are made live from a source, read-only while live. //! Line 1's first word names the source: `/pat` the owner's text (smart- @@ -18,7 +18,7 @@ //! text: B3 on one looks, B2 on line 1 runs it again. Wherever a row points into //! an open pane's text, that pane's places (Places.zig) show the set: //! tints, rail ticks, the current one selected. A row pointing at a file -//! no pane shows is shown in the +Preview attached under this pane; Enter +//! no pane shows is shown in the +Preview docked under this pane; Enter //! promotes the preview to the file's pane where it stands. //! //! Nothing moves while you type: the pane never closes, resizes or @@ -319,7 +319,7 @@ fn create(p: *Pardes, owner_id: usize, line: []const u8, source: Source) ?usize preview_rows = spare -| want; } } - if (!layout.attachFrom(p, owner_id, free, want, owner_id)) { + if (!layout.dockFrom(p, owner_id, free, want, owner_id)) { // An owner too short to give a query pane its rows: placed as any // new pane is, the one place a search moves another pane. layout.placeNew(p, owner_id, owner_id, free, .doc); @@ -1635,7 +1635,7 @@ fn makePreview(p: *Pardes, qid: usize, rows: u16, giver: usize) ?usize { return null; }; layout.compute(p); - if (!layout.attachFrom(p, qid, free, rows, giver)) { + if (!layout.dockFrom(p, qid, free, rows, giver)) { p.removePane(free, qid) catch |err| p.reportError(.at(qid), "query", err); return null; } @@ -1723,7 +1723,7 @@ fn displayPreview(p: *Pardes, qid: usize, path: []const u8, at: look.Spot) void /// The +Preview becomes the file's pane where it stands: same slot, same /// serial, same rect, its scroll and selection as the preview left them. /// It is a file pane from here: an empty undo history, the Recent entry, -/// the watch, a file's tag; and a pane of its own, no longer attached (it +/// the watch, a file's tag; and a pane of its own, no longer docked (it /// stays when its query pane goes). fn promote(p: *Pardes, qid: usize, id: usize) void { const pane = p.panes[id] orelse return; @@ -1902,10 +1902,10 @@ pub fn cancel(p: *Pardes, id: usize) void { if (owner_id) |oid| p.view().active = oid; return; } - // Attached, its rows go back to its owner; else to its own column's. - const attached = layout.ownerOf(p, id) != null; + // Docked, its rows go back to its owner; else to its own column's. + const docked = layout.ownerOf(p, id) != null; if (owner_id) |oid| { - p.removePane(id, if (attached) oid else null) catch |err| p.reportError(.at(id), "query", err); + p.removePane(id, if (docked) oid else null) catch |err| p.reportError(.at(id), "query", err); p.view().active = oid; if (layout.findPane(p, oid)) |at| p.setActiveColumn(at.col); } else p.removePane(id, null) catch |err| p.reportError(.at(id), "query", err); diff --git a/core/Store.zig b/core/Store.zig index 82e3c5bf..ac9387cb 100644 --- a/core/Store.zig +++ b/core/Store.zig @@ -28,7 +28,7 @@ pub const Closed = struct { /// brought back, it takes them from that pane alone. gainer: u32, below: bool, - /// The pane it was attached to, by serial (0 none). + /// The pane it was docked to, by serial (0 none). owner: u32, rows: u16, /// What its Panes row shows: its file, command or directory. @@ -78,7 +78,7 @@ pub fn clone(s: *const Store, gpa: std.mem.Allocator) Store { // ---- the closed panes ---- /// Pane `id`, about to close, kept: what it was (a one-pane Dump) and -/// where (its column, its rows, what it was attached to). Null for a pane +/// where (its column, its rows, what it was docked to). Null for a pane /// that is no pane of the user's: a query pane, a preview, one carried to /// another window (`away`), one made and refused in the same step (never /// announced), or one whose dump fails or is too big. `close` finishes it @@ -186,7 +186,7 @@ pub fn closedBySerial(s: *const Store, serial: u32) ?*Closed { } /// Closed pane `serial` of this session made again, where it was: beside -/// the pane its rows went to, taking them from that pane alone (attached +/// the pane its rows went to, taking them from that pane alone (docked /// again to its owner when that is still open), else placed as a new pane /// from `from`. False when it is not this session's, or its dump will not /// load; the keyboard on it otherwise. @@ -204,7 +204,7 @@ pub fn reopen(s: *Store, p: *Pardes, serial: u32, from: usize) bool { const owner = if (place.owner != 0) p.paneBySerial(place.owner) else null; const gainer = if (place.gainer != 0) p.paneBySerial(place.gainer) else null; const placed = if (owner) |o| - layout.attachFrom(p, o, free, place.rows, o) + layout.dockFrom(p, o, free, place.rows, o) else if (gainer) |g| layout.giveBack(p, free, g, place.below, place.rows) else diff --git a/core/builtins.zig b/core/builtins.zig index 894478fd..7ad70e7c 100644 --- a/core/builtins.zig +++ b/core/builtins.zig @@ -1017,11 +1017,11 @@ pub const Del = struct { // acme's Del asks winclean first (exec.c del): unsaved text is warned // about once, and the same Del again, nothing edited since, closes. if (warnModifiedIn(c, .Del, .{ .pane = c.id })) return; - // An attachment's rows go back to its owner: nothing to ask. + // A docked pane's rows go back to its owner: nothing to ask. if (layout.ownerOf(c.p, c.id)) |owner| return c.p.removePane(c.id, owner) catch |err| c.p.reportError(.at(c.id), "close", err); const at = layout.findPane(c.p, c.id); const above = if (at) |f| layout.expandedNeighbor(c.p, f.col, f.idx, .above) else null; - // An owner's attachments close with it: below is past them. + // An owner's docked panes close with it: below is past them. const below = if (at) |f| layout.expandedNeighbor(c.p, f.col, layout.groupEnd(c.p, f.col, f.idx) - 1, .below) else null; const to: ?usize = if (std.mem.eql(u8, side, "k")) above orelse below diff --git a/core/layout.zig b/core/layout.zig index 9c99dc7d..4c7d6afb 100644 --- a/core/layout.zig +++ b/core/layout.zig @@ -249,8 +249,8 @@ fn splitRowFor(y: u16, h: u16, cur_y: u16, least: ?u16) ?u16 { } /// Where pane `id` dragged by its grip to (`cur_x`, `cur_y`) lands. An -/// owner's grip drags its group; an attachment's drags it alone, which -/// within its group resizes it and anywhere else detaches it (movePane). +/// owner's grip drags its group; a docked pane's drags it alone, which +/// within its group resizes it and anywhere else undocks it (movePane). /// Another group is one place: a pane dropped on it lands under all of it. pub fn movePlacement(p: *Pardes, id: usize, cur_x: u16, cur_y: u16) ?MovePlacement { const v = p.view(); @@ -285,8 +285,8 @@ pub fn movePlacement(p: *Pardes, id: usize, cur_x: u16, cur_y: u16) ?MovePlaceme k += 1; continue; } - // Its own group's panes are places of their own: that is how an - // attachment's grip resizes it against its owner. + // Its own group's panes are places of their own: that is how a + // docked pane's grip resizes it against its owner. const unit_end = if (groupRoot(p, v.cols[tc].panes[k]) == own_root) k + 1 else groupEnd(p, tc, k); var h: u16 = 0; for (k..unit_end) |j| { @@ -313,8 +313,8 @@ pub fn movePlacement(p: *Pardes, id: usize, cur_x: u16, cur_y: u16) ?MovePlaceme return last; } -/// Move pane `id`, and the group it owns, where movePlacement says. An -/// attachment moved anywhere but within its own group is detached there. +/// Move pane `id`, and the group it owns, where movePlacement says. A +/// docked pane moved anywhere but within its own group is undocked there. pub fn movePane(p: *Pardes, id: usize, cur_x: u16, cur_y: u16) void { const v = p.view(); const placement = movePlacement(p, id, cur_x, cur_y) orelse return; @@ -549,7 +549,7 @@ pub fn acmePlace(p: *Pardes, c: usize, origin: ?usize, id: usize) void { var empty: ?usize = null; for (p.view().cols[c].panes[0..n]) |k| { const pane = p.panes[k] orelse continue; - // An attachment is its owner's: never halved for another pane. + // A docked pane is its owner's: never halved for another pane. if (pane.collapsed or ownerOf(p, k) != null) continue; // `>=`: at a tie the one nearer the bottom, as acme picks. if (big == null or bodyRows(p, k) >= bodyRows(p, big.?)) big = k; @@ -1076,7 +1076,7 @@ pub fn absorbVWeight(p: *Pardes, id: usize, to: ?usize) ?usize { var k = f.idx; while (to == null and k > 0) : (k -= 1) { sib = v.cols[f.col].panes[k - 1]; - // nor to a pane attached to another: rows go to owners + // nor to a pane docked to another: rows go to owners if (p.panes[sib]) |pp| if (if (pp.file) |ff| panes.Output.fileTraits(ff.output).doc else true) if (ownerOf(p, sib) == null) break; } const s = p.panes[sib] orelse return null; @@ -1112,26 +1112,26 @@ pub fn splitBelow(p: *Pardes, src_id: usize, nw: *Pane) void { }; } -// ---- Attached panes ---- +// ---- Docked panes ---- // -// A results pane (+Search, +Callstack, +Diff, +Errors) is ATTACHED to the +// A results pane (+Search, +Callstack, +Diff, +Errors) is DOCKED to the // pane it answers for, its owner (Pane.docked_to). The owner and what is -// attached to it, and what is attached to those (a preview under a +// docked to it, and what is docked to those (a preview under a // +Search), are a GROUP: contiguous in one column, the owner first. A group // is one place to everything else in the layout: an unrelated pane is never // put inside it (acmePlace, splitAt, splitTallest), a pane dragged onto it // lands under all of it (movePlacement), and its owner's grip, Collapse and -// Del take all of it (movePane, toggleCollapse, Pardes.removePane). An -// attachment's rows come from its owner and go back to it, nobody else's. +// Del take all of it (movePane, toggleCollapse, Pardes.removePane). A +// docked pane's rows come from its owner and go back to it, nobody else's. -/// The slot of `id`'s owner, when `id` is attached to a live pane. +/// The slot of `id`'s owner, when `id` is docked to a live pane. pub fn ownerOf(p: *const Pardes, id: usize) ?usize { const serial = (p.panes[id] orelse return null).docked_to orelse return null; for (p.panes, 0..) |slot, i| if (slot) |pane| if (pane.serial == serial and i != id) return i; return null; } -/// The owner at the top of `id`'s group: `id` itself when it is attached to +/// The owner at the top of `id`'s group: `id` itself when it is docked to /// nothing. Bounded: a dump could name a ring of owners. pub fn groupRoot(p: *const Pardes, id: usize) usize { var at = id; @@ -1139,7 +1139,7 @@ pub fn groupRoot(p: *const Pardes, id: usize) usize { return at; } -/// Whether `id` is `root` or attached to it through any number of owners. +/// Whether `id` is `root` or docked to it through any number of owners. fn descends(p: *const Pardes, id: usize, root: usize) bool { var at = id; for (0..MAX_PANES) |_| { @@ -1150,7 +1150,7 @@ fn descends(p: *const Pardes, id: usize, root: usize) bool { } /// One past the last pane of the group that pane `idx` of column `c` is -/// in: `idx + 1` for a pane with nothing attached. +/// in: `idx + 1` for a pane with nothing docked. pub fn groupEnd(p: *const Pardes, c: usize, idx: usize) usize { const v = p.view(); const root = groupRoot(p, v.cols[c].panes[idx]); @@ -1159,11 +1159,11 @@ pub fn groupEnd(p: *const Pardes, c: usize, idx: usize) usize { return k; } -/// The attachments kept where they are attached: one whose owner is gone, +/// The docked panes kept where they are docked: one whose owner is gone, /// or that something (a 9P move, a pane split into a column of its own, an /// owner moved by a route that does not carry its group) left anywhere but /// right under its owner's group, is an ordinary pane from then on, where -/// it stands. Nothing moves. Top to bottom, so a nested attachment is +/// it stands. Nothing moves. Top to bottom, so a nested docked pane is /// judged after the one it hangs from. pub fn keepGroups(p: *Pardes) void { for (0..p.view().ncol) |c| for (p.view().cols[c].panes[0..p.view().cols[c].n], 0..) |id, k| { @@ -1175,17 +1175,17 @@ pub fn keepGroups(p: *Pardes) void { }; } -/// Attach new pane `id`, in no column yet, to `owner`: under the owner's +/// Dock new pane `id`, in no column yet, to `owner`: under the owner's /// group, `rows` of the owner's rows (tag included), from the owner and /// from no other pane. The owner keeps its own minimum, else its tag (acme -/// lets a window shrink to it), so the attachment may get fewer. A folded -/// owner is unfolded first. The rows are the attachment's from then on: +/// lets a window shrink to it), so the docked pane may get fewer. A folded +/// owner is unfolded first. The rows are the docked pane's from then on: /// nothing here ever resizes it again; the seam is the user's to drag. /// False, `id` in no column, when the owner has not the rows for its tag -/// and the attachment's minimum. The rows are given by `giver`: the owner +/// and the docked pane's minimum. The rows are given by `giver`: the owner /// itself or a pane of its group (a +Preview added under a query pane later /// takes the text's rows, so the query pane, typed into, keeps its own). -pub fn attachFrom(p: *Pardes, owner: usize, id: usize, rows: u16, giver: usize) bool { +pub fn dockFrom(p: *Pardes, owner: usize, id: usize, rows: u16, giver: usize) bool { const v = p.view(); const o = p.panes[owner] orelse return false; const g = p.panes[giver] orelse return false; @@ -1238,10 +1238,10 @@ pub fn giveBack(p: *Pardes, id: usize, gainer: usize, below: bool, rows: u16) bo return true; } -/// Collapse on an owner with attachments: the whole group folds to its +/// Collapse on an owner with docked panes: the whole group folds to its /// tags, every row it gave up to the one unfolded neighbour outside it, /// and unfolds again from that neighbour, as one pane's Collapse does. -/// ponytail: unfolding opens every attachment, one folded alone before +/// ponytail: unfolding opens every docked pane, one folded alone before /// included; remembering which were is a bit a pane. fn collapseGroup(p: *Pardes, c: usize, start: usize, end: usize) void { const v = p.view(); @@ -1281,7 +1281,7 @@ pub fn toggleCollapse(p: *Pardes, id: usize) void { const pane = p.panes[id] orelse return; const at = findPane(p, id) orelse return; compute(p); - // An owner folds and unfolds with what is attached to it. + // An owner folds and unfolds with what is docked to it. if (ownerOf(p, id) == null) { const end = groupEnd(p, at.col, at.idx); if (end > at.idx + 1) return collapseGroup(p, at.col, at.idx, end); @@ -1635,8 +1635,8 @@ pub fn reprojectTagHit(p: *const Pardes, tag_hit: TagHit) ?TagHit { return Layer.tagAgain(tag_hit); } -/// A test's attachment: an empty +Search in a new slot, in no column. -fn testAttachment(p: *Pardes) !usize { +/// A test's docked pane: an empty +Search in a new slot, in no column. +fn testDocking(p: *Pardes) !usize { const free = p.freeSlot().?; _ = try panes.Output.open(p, free, "/tmp", .search, "", try p.gpa.dupe(u8, "q\n")); return free; @@ -1884,7 +1884,7 @@ test "column reorder moves only crossed state and preserves weights" { try std.testing.expectEqual(@as(i32, 21), p.view().col_tags[1].cur_col); } -test "an attachment takes its rows from its owner alone, keeps them, and moves, folds and closes with it" { +test "a docked pane takes its rows from its owner alone, keeps them, and moves, folds and closes with it" { const exec = pardes.exec; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 48 }); defer p.deinit(); @@ -1900,8 +1900,8 @@ test "an attachment takes its rows from its owner alone, keeps them, and moves, const unrelated = [_]usize{ below, other_col }; // Under its owner, the rows asked for, the owner's and nobody else's. - const s = try testAttachment(p); - try std.testing.expect(attachFrom(p, 0, s, 9, 0)); + const s = try testDocking(p); + try std.testing.expect(dockFrom(p, 0, s, 9, 0)); try std.testing.expectEqual(@as(?usize, 0), ownerOf(p, s)); try std.testing.expectEqual(s, p.view().cols[0].panes[1]); for (unrelated) |k| try std.testing.expectEqualDeep(before[k], p.view().rects[k]); @@ -1909,8 +1909,8 @@ test "an attachment takes its rows from its owner alone, keeps them, and moves, try std.testing.expectEqual(before[0].y, p.view().rects[0].y); try std.testing.expectEqual(@as(u16, 9), p.view().rects[s].h); // A second level (a preview under a query pane): out of the first's rows. - const pv = try testAttachment(p); - try std.testing.expect(attachFrom(p, s, pv, 4, s)); + const pv = try testDocking(p); + try std.testing.expect(dockFrom(p, s, pv, 4, s)); try std.testing.expectEqual(pv, p.view().cols[0].panes[2]); try std.testing.expectEqual(@as(usize, 0), groupRoot(p, pv)); try std.testing.expectEqual(@as(usize, 3), groupEnd(p, 0, 0)); @@ -1925,7 +1925,7 @@ test "an attachment takes its rows from its owner alone, keeps them, and moves, compute(p); try std.testing.expectEqual(@as(u16, 5), p.view().rects[s].h); - // An unrelated New, from the owner or from its attachment, never lands + // An unrelated New, from the owner or from its docked pane, never lands // inside the group. exec.runBuiltin(p, .New, 0, "", null); exec.runBuiltin(p, .New, s, "", null); @@ -1933,7 +1933,7 @@ test "an attachment takes its rows from its owner alone, keeps them, and moves, try std.testing.expectEqual(s, p.view().cols[at.col].panes[at.idx + 1]); try std.testing.expectEqual(pv, p.view().cols[at.col].panes[at.idx + 2]); - // The seam between owner and attachment is the user's: the pair alone. + // The seam between owner and docked pane is the user's: the pair alone. compute(p); const pre_drag = p.view().rects; applyRowSplit(p, at.col, at.idx, p.view().rects[s].y - 3); @@ -1965,7 +1965,7 @@ test "an attachment takes its rows from its owner alone, keeps them, and moves, try std.testing.expect(p.panes[pv] == null); compute(p); try std.testing.expectEqual(pair[s].h + pair[pv].h, p.view().rects[s].h); - // Del of the attachment gives its rows back to the owner, nobody else. + // Del of the docked pane gives its rows back to the owner, nobody else. pair = p.view().rects; exec.runBuiltin(p, .Del, s, "", null); try std.testing.expect(p.panes[s] == null); @@ -1973,19 +1973,19 @@ test "an attachment takes its rows from its owner alone, keeps them, and moves, try std.testing.expectEqual(pair[0].h + pair[s].h, p.view().rects[0].h); for (p.view().cols[1].panes[0..p.view().cols[1].n]) |k| if (k != 0) try std.testing.expectEqualDeep(pair[k], p.view().rects[k]); - // Del of the owner closes what is attached to it. - const again = try testAttachment(p); - try std.testing.expect(attachFrom(p, 0, again, 6, 0)); + // Del of the owner closes what is docked to it. + const again = try testDocking(p); + try std.testing.expect(dockFrom(p, 0, again, 6, 0)); exec.runBuiltin(p, .Del, 0, "", null); try std.testing.expect(p.panes[0] == null and p.panes[again] == null); } -test "an attachment survives Dump and Restore, and one left away from its owner is a pane of its own" { +test "a docked pane survives Dump and Restore, and one left away from its owner is a pane of its own" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }); defer p.deinit(); _ = try p.setTestFile("alpha\nbeta\nalphabet\n"); - const s = try testAttachment(p); - try std.testing.expect(attachFrom(p, 0, s, 8, 0)); + const s = try testDocking(p); + try std.testing.expect(dockFrom(p, 0, s, 8, 0)); try std.testing.expectEqual(@as(?usize, 0), ownerOf(p, s)); try dump.dumpState(p); const restored = try dump.initFromDump(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 40 }, p.dump_out.?); @@ -1995,8 +1995,8 @@ test "an attachment survives Dump and Restore, and one left away from its owner pardes.exec.runBuiltin(p, .Undock, s, "", null); try std.testing.expect(p.panes[s].?.docked_to == null); // Put above its owner by a route that does not carry groups: detached. - const t = try testAttachment(p); - try std.testing.expect(attachFrom(p, 0, t, 8, 0)); + const t = try testDocking(p); + try std.testing.expect(dockFrom(p, 0, t, 8, 0)); try std.testing.expectEqual(@as(?usize, 0), ownerOf(p, t)); removePane(p, t); insert(p, 0, 0, t); diff --git a/core/panes.zig b/core/panes.zig index 68304437..174af241 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -147,10 +147,10 @@ pub const Pane = struct { vweight: f32 = 1, /// A folded pane keeps its expansion weight, but occupies only its tag row. collapsed: bool = false, - /// The serial of the pane this one is attached to, its owner: a query + /// The serial of the pane this one is docked to, its owner: a query /// pane or its +Preview sits right under its owner in the owner's /// column, takes its rows from the owner alone, and moves, folds and - /// closes with it (layout.zig, "Attached panes"). An owner that is + /// closes with it (layout.zig, "Docked panes"). An owner that is /// gone, or a pane no longer right under its owner's group, leaves it /// an ordinary pane (layout.keepGroups). docked_to: ?u32 = null, @@ -1476,14 +1476,14 @@ pub fn paneDir(pane: *const Pane) []const u8 { pub fn removePane(p: *Pardes, id: usize, to: ?usize) error{OutOfMemory}!void { const v = p.view(); const pane = p.panes[id] orelse return; - // What is attached to it closes with it, first, each giving its rows + // What is docked to it closes with it, first, each giving its rows // back to it: then its rows, theirs among them, go where a pane's go. for (0..p.panes.len) |k| if (p.panes[k]) |other| if (k != id and other.docked_to == pane.serial) { if (layout.ownerOf(p, k) != id) continue; try p.removePane(k, id); layout.compute(p); }; - // An attachment's rows go back to its owner and nobody else. + // A docked pane's rows go back to its owner and nobody else. const owner = layout.ownerOf(p, id); const place = layout.findPane(p, id); const emptied = if (place) |f| (if (v.cols[f.col].n == 1) f.col else null) else null; diff --git a/docs/next-daemon.md b/docs/next-daemon.md index 538729e6..9ed25f9c 100644 --- a/docs/next-daemon.md +++ b/docs/next-daemon.md @@ -1444,7 +1444,7 @@ dump hooks; `pardes-snap --dump`, `pardes-monkey --dump`, and both in Handover's dump in flight and its carrier, and the host's fallback file table are authority: host errands, not state. - **Restore keeps serials.** Renumbering would rewrite every serial the - session holds (attachments, query owners, places, messages, LSP and + session holds (docked panes, query owners, places, messages, LSP and callstack requests); Restore hangs up every connection anyway. The next serials are past the old session's; `restored`/`restoredcol` records are gone. A Restore over an older session keeps the host's facts (cell diff --git a/docs/next-drag.md b/docs/next-drag.md index 47ccdb0b..dd2f24ed 100644 --- a/docs/next-drag.md +++ b/docs/next-drag.md @@ -43,7 +43,7 @@ window it goes to is found by asking every registry session. grip) released outside goes to `Handover.begin` instead of the layout move. Inside the window the grip drag is exactly as before. - `core/Handover.zig` (`Pardes.handover`), the core half: the pane with the - panes attached to it (an attachment dragged alone goes alone, unattached), + panes docked to it (a docked pane dragged alone goes alone, undocked), or the column, is dumped alone: `dump.dumpBytes(p, keep, carried)`, which `dumpState` now calls with no mask; `State.carried` (`pane`/`column`) marks such a dump. Each carried pane's serial and `File.revision` is @@ -61,7 +61,7 @@ window it goes to is found by asking every registry session. - `Handover.finish`: taken, each carried pane is closed with `Pardes.removePane` (Del's rows rule: its rows go to its neighbour; a carried column's empty column is dropped); a pane whose revision changed - since the dump is kept, unattached ("copied to …; edited on the way, kept + since the dump is kept, undocked ("copied to …; edited on the way, kept here too"). Refused or failed: everything stays, the reason on the message row. One handover flies at a time. - New option `--geometry=WxH[+X+Y]` (runtime/main.zig, `Options.geometry`). @@ -80,7 +80,7 @@ window it goes to is found by asking every registry session. dumped panes into free slots and places them where the pointer is: a pane goes right under the group the pointer is over, out of that group owner's rows alone (the owner keeps its rows down to the pointer's row; - over one of its attachments, half); a column goes beside the column the + over one of its docked panes, half); a column goes beside the column the pointer is over, out of that column's width alone (`insertColumn`). Every other pane's rect is unchanged (tested). The ctl write is answered after the panes are in, so the source closes its pane only once the target has diff --git a/docs/search-proto-converge.md b/docs/search-proto-converge.md index da336f7c..3af49a06 100644 --- a/docs/search-proto-converge.md +++ b/docs/search-proto-converge.md @@ -2,11 +2,11 @@ The design the twelve prototypes added up to (CONVERGE.md), built as the product in six changes. One pane kind does all searching: the **query -pane**, a `+Search` attached under the pane that asked (its *owner*), whose +pane**, a `+Search` docked under the pane that asked (its *owner*), whose body's line 1 is the query, typed into, and whose rows below are made live from a source. The owner shows the set in its own text (its **places**: tints, rail ticks, the current one selected), and a row that points at a -file no pane shows is shown in a **+Preview** attached under the query +file no pane shows is shown in a **+Preview** docked under the query pane. Everything on screen is text in a pane: B1/B2/B3 and the chords work on all of it, nothing is drawn over anything, and the notice band keeps only the prompts that are not search. @@ -15,7 +15,7 @@ only the prompts that are not search. | piece | file | lifted from | |---|---|---| -| attached panes: a group under its owner, rows from the owner alone, moving/folding/closing with it, seam drag, Dump/Restore, `Undock` | `core/layout.zig` "Attached panes", `Pane.docked_to` | attached | +| docked panes: a group under its owner, rows from the owner alone, moving/folding/closing with it, seam drag, Dump/Restore, `Undock` | `core/layout.zig` "Docked panes", `Pane.docked_to` | attached | | places: every match tinted, rail ticks (B1 on a tick goes there), current selected and in view, smart-case regex, view-first sliced scan, silent wrap | `core/Places.zig`, `Pane.places` | incsearch (MatchSet) | | the query pane: line 1, its first word the source, live rows, preview, Enter/Esc/Del, reuse, settings | `core/Query.zig`, `Pane.query` | queryline, pick, live, preview, everywhere | | fuzzy names (files, recent, panes, declarations) | `core/Names.zig` | pick (its scorer, whole) | @@ -113,7 +113,7 @@ tint (`Query.paintMark`), no selection: a click, a sweep or a chord never erases it and B2 / B3 on it take the word clicked, as on any row. **Enter** puts the keyboard on the current hit in its pane (the +Preview -promoted in place: same slot, serial, rect, an unattached file pane from +promoted in place: same slot, serial, rect, an undocked file pane from then on), fills `/`, and freezes the rows into ordinary text (tag ` Save Undock Del`). A `/` freezes its whole list (every place found first, 2000 rows at most), a Grep every line it has. **Esc** while typing puts every -- cgit v1.3 From 2d75490196a9d15eff6ac471e9584101a5697afe Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 20 Nov 2026 15:21:27 -0300 Subject: core: the switchboard's view fields are View.Id: Authority.view_of and Peer.view (P21: the fields; the last change of the slots work, apart for the pair's merge): the in-process Authority's openView, leave, closeView and take, and Peers' input, closeViewOf and the welcome hand the core its view's id with no conversion (9 .at( and an .index() go); Screens.flush's view parameter, which its body never read, goes with its four arguments (Peers, the in-process harness, echo.zig's, test/replicas.zig's); the undrawn mask's shift narrows the slot's integer, which the compiler caught (core/replica.zig:2362, :2507: the old @intCast narrowed the bare u8; a view's slot as a bit index, no fault), as it caught test/replicas.zig:1047's detach_view, a view's slot as a bare u8 against a peer's (no fault: p.view.index() == k); Replica.view and Joined.view stay u8: their readers (the echo, drawOne, the frontends' own view, client.zig, session.zig) index and compare with the core's live as integers (+4, +8 by the estimate); neither field typed here is dumped or digested and the welcome's byte is the same; the conversions fall: the core's code 427 -> 425 (.at( 333 -> 328, .index() 73 -> 76); gate on the whole stack (load 5-22): tui core-test 871/1028 (157 skipped), shell-test 1070/1073, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, consumer-test passes, addon-test 5/5, process-test 0 of 144, replicas --clients 5 (diverged 0, unequal 0, deltas 1976/0 1937/0 1831/0, quiet 651/0 673/0 779/0, unlisted 0, corpus 22 of 22, no leak) and --bytes --clients 5 (diverged 0, unequal 0, quiet 693/0 586/0 829/0, unlisted 0, corpus 22 of 22); the semantics word a73794ff9e03f814 as merge40's; daemon.py --far, --games, --window-clients pass, --upgrade both ways against merge39's build (3f9dfd3b9d8bdc64; merge40's has this word, which the test refuses) pass, plain fails at "client C agrees with a shell's output" 4 of 6 as merge40's build does 3 of 6 (alternated: 2 of 4 each); the macOS library (x86_64-linux, aarch64-macos, the ABI guard 2/2) and the FreeBSD cross-build build; frames 77/77, gui unit-test 1666/1670 (the perf check's BaselineHarnessMismatch), perfab corpus2x -0.014% (noise 0.078%), the 121 per-operation counts within 0.1% against tree2 (key-down on medium 10,039,745, render on medium 11,454,642, client-key-down on medium 1,983,990; merge40's gate 10,039,703, 11,454,619, 1,984,321) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/echo.zig | 2 +- core/replica.zig | 40 ++++++++++++++++++++-------------------- test/replicas.zig | 4 ++-- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'core') diff --git a/core/echo.zig b/core/echo.zig index 40200696..f35c9f9d 100644 --- a/core/echo.zig +++ b/core/echo.zig @@ -614,7 +614,7 @@ const Rig = struct { for (msgs.items) |m| gpa.free(m); msgs.deinit(gpa); } - try g.screens.flush(g.a.core, g.peer, g.r.view, &msgs); + try g.screens.flush(g.a.core, g.peer, &msgs); for (msgs.items) |m| if (g.r.screen(m)) |reply| { _ = try g.screens.take(g.a.core, g.peer, reply); }; diff --git a/core/replica.zig b/core/replica.zig index ff1e138e..1a127ad4 100644 --- a/core/replica.zig +++ b/core/replica.zig @@ -157,7 +157,7 @@ pub const Authority = struct { seq: u32 = 0, /// Each client's view (core/views.zig): its own layout, focus and /// cursors over the session's text. The first client has the session's. - view_of: [64]u8 = @splat(0), + view_of: [64]Pardes.View.Id = @splat(.at(0)), /// Steps of its own taken since the last unit (`output`): one unit, /// `pending`, sent before the next input it steps and at a frame. batched: u32 = 0, @@ -279,7 +279,7 @@ pub const Authority = struct { }; a.core.pump(a.host) catch {}; was.end(); - a.view_of[client] = k.index(); + a.view_of[client] = k; a.seq += 1; return .{ .view = k.index(), .unit = try a.unit(0, a.seq) }; } @@ -296,7 +296,7 @@ pub const Authority = struct { const again = if (back) |v| a.core.rejoinView(.at(v)) else false; const k = (if (again) back else if (a.core.openView()) |o| o.index() else null) orelse return null; a.core.undrawn |= @as(u8, 1) << @intCast(k); - a.view_of[client] = k; + a.view_of[client] = .at(k); a.seq += 1; const u = try a.unit(0, a.seq); var blobs: std.ArrayListUnmanaged(walk.Deferred) = .empty; @@ -322,8 +322,8 @@ pub const Authority = struct { std.debug.assert(a.batched == 0); const was = Stepping.begin(&a.t, null); const k = a.view_of[client]; - a.core.undrawn &= ~(@as(u8, 1) << @intCast(k)); - if (again) a.core.awayView(.at(k)) else a.core.closeView(.at(k)); + a.core.undrawn &= ~(@as(u8, 1) << @intCast(k.index())); + if (again) a.core.awayView(k) else a.core.closeView(k); was.end(); a.seq += 1; return a.unit(0, a.seq); @@ -333,7 +333,7 @@ pub const Authority = struct { pub fn closeView(a: *Authority, client: u16) ![]const u8 { std.debug.assert(a.batched == 0); const was = Stepping.begin(&a.t, null); - a.core.closeView(.at(a.view_of[client])); + a.core.closeView(a.view_of[client]); was.end(); a.seq += 1; return a.unit(0, a.seq); @@ -345,7 +345,7 @@ pub const Authority = struct { std.debug.assert(a.batched == 0); const in = parseInput(msg) orelse return error.BadInput; const was = Stepping.begin(&a.t, null); - a.core.toView(.at(a.view_of[in.client])); + a.core.toView(a.view_of[in.client]); a.t.stamp = stampOf(in); a.core.update(in.event); a.core.step(); @@ -450,7 +450,7 @@ pub const Screens = struct { /// What `peer` is owed of every terminal, each a message onto `out` /// (owned): nothing for one it has as it is, or with `bound` in flight. - pub fn flush(s: *Screens, core: *Pardes, peer: u16, _: u8, out: *std.ArrayListUnmanaged([]u8)) !void { + pub fn flush(s: *Screens, core: *Pardes, peer: u16, out: *std.ArrayListUnmanaged([]u8)) !void { const t0 = nowNs(); defer s.encode_ns += nowNs() - t0; for (core.panes, 0..) |slot, id| { @@ -1667,7 +1667,7 @@ pub const Peer = struct { peers: *Peers, fd: c_int, id: u16, - view: u8, + view: Pardes.View.Id, /// Its process (its socket's peer), for `--ps`; 0 not known. pid: libc.pid_t = 0, /// Its bye said it joins again for its view (a divergence's rejoin): @@ -2201,7 +2201,7 @@ pub const Peers = struct { // The terminals as this step reads them, then the step, the rows // it read, its unit (part B terminal notes' order). ps.screensOut(core, .flush); - core.toView(.at(peer.view)); + core.toView(peer.view); ps.t.stamp = stampOf(in); core.update(in.event); core.step(); @@ -2239,7 +2239,7 @@ pub const Peers = struct { ps.msgs.clearRetainingCapacity(); } (switch (what) { - .flush => ps.screens.flush(core, peer.sid, peer.view, &ps.msgs), + .flush => ps.screens.flush(core, peer.sid, &ps.msgs), .fill => ps.screens.fill(core, peer.sid, &ps.msgs), }) catch return; if (what == .flush) if (ps.flushed) |h| h.f(h.ctx, core, &ps.screens); @@ -2325,12 +2325,12 @@ pub const Peers = struct { core.gpa.free(bytes); return daemon.refuseReplica(fd, "out of memory"); }; - peer.* = .{ .peers = ps, .fd = fd, .id = ps.next_id, .view = k, .limit = lag_max, .dump = bytes, .blobs = blobs, .dump_gpa = core.gpa }; + peer.* = .{ .peers = ps, .fd = fd, .id = ps.next_id, .view = .at(k), .limit = lag_max, .dump = bytes, .blobs = blobs, .dump_gpa = core.gpa }; ps.next_id +%= 1; if (ps.next_id == 0) ps.next_id = 1; // The session's digest as dumped, for the joiner to check its load by. const digest = tape.digestOf(core); - peer.welcome_len = (wire.encodeServer(&peer.welcome, .{ .welcome = .{ .pid = @intCast(libc.getpid()), .session = ps.name[0..@min(ps.name.len, wire.max_name)], .client = peer.id, .view = .at(k), .dump_len = whole, .gmtoff = gmtoff(), .digest = digest, .semantics = wire.semantics, .blobs = @intCast(blobs.items.len) } }) catch unreachable).len; + peer.welcome_len = (wire.encodeServer(&peer.welcome, .{ .welcome = .{ .pid = @intCast(libc.getpid()), .session = ps.name[0..@min(ps.name.len, wire.max_name)], .client = peer.id, .view = peer.view, .dump_len = whole, .gmtoff = gmtoff(), .digest = digest, .semantics = wire.semantics, .blobs = @intCast(blobs.items.len) } }) catch unreachable).len; if (ps.threads) peer.writer = std.Thread.spawn(.{}, Peer.writeLoop, .{peer}) catch null; if (ps.threads) peer.reader = std.Thread.spawn(.{}, Peer.readLoop, .{peer}) catch null; if (ps.threads and (peer.writer == null or peer.reader == null)) { @@ -2359,7 +2359,7 @@ pub const Peers = struct { log.info("client {d} left '{s}'", .{ peer.id, ps.name }); ps.tellClients(); ps.screens.dropPeer(peer.sid); - core.undrawn &= ~(@as(u8, 1) << @intCast(peer.view)); + core.undrawn &= ~(@as(u8, 1) << @intCast(peer.view.index())); ps.closeViewOf(core, peer, peer.again); if (ps.count() == 0) core.unattended = ps.detached; if (ps.count() == 0 and peer.close and !ps.kept) ps.closed = true; @@ -2374,7 +2374,7 @@ pub const Peers = struct { /// session no one else watches leaves the session its layout, for a /// client that comes after to find. fn closeViewOf(ps: *Peers, core: *Pardes, peer: *Peer, again: bool) void { - if (again) core.awayView(.at(peer.view)) else if (ps.count() == 0 and ps.detached) core.leaveView(.at(peer.view)) else core.closeView(.at(peer.view)); + if (again) core.awayView(peer.view) else if (ps.count() == 0 and ps.detached) core.leaveView(peer.view) else core.closeView(peer.view); } /// Its threads ended and joined, its link closed. @@ -2466,7 +2466,7 @@ pub const Peers = struct { /// Detach typed in client view `k`'s: told it left the session running /// (`left`), its last word; the client goes, and its reader says so. pub fn detach(ps: *Peers, k: u8) bool { - for (ps.list) |slot| if (slot) |peer| if (peer.view == k) { + for (ps.list) |slot| if (slot) |peer| if (peer.view.index() == k) { ps.kept = true; var out: [wire.max_name + 8]u8 = undefined; peer.last(wire.encodeServer(&out, .{ .left = ps.name[0..@min(ps.name.len, wire.max_name)] }) catch unreachable); @@ -2504,7 +2504,7 @@ pub const Peers = struct { fn drop(ps: *Peers, core: *Pardes, again: bool) void { for (&ps.list) |*slot| if (slot.*) |peer| { slot.* = null; - core.undrawn &= ~(@as(u8, 1) << @intCast(peer.view)); + core.undrawn &= ~(@as(u8, 1) << @intCast(peer.view.index())); ps.closeViewOf(core, peer, again); ps.screens.dropPeer(peer.sid); ps.letGo(peer); @@ -3470,7 +3470,7 @@ fn deliver(a: *Authority, screens: *Screens, peer: u16, r: *Replica, comptime wh msgs.deinit(gpa); } switch (what) { - .flush => try screens.flush(a.core, peer, r.view, &msgs), + .flush => try screens.flush(a.core, peer, &msgs), .fill => { try screens.fill(a.core, peer, &msgs); screens.filled(a.core); @@ -3503,7 +3503,7 @@ fn farJoinOnce(ps: *Peers, core: *Pardes, have: ?*Have) !Joined { var whole = state.len; for (blobs.items) |b| whole += b.bytes.len; const peer = try ps.gpa.create(Peer); - peer.* = .{ .peers = ps, .fd = fds[0], .id = 1, .view = 0, .dump = state, .blobs = blobs, .dump_gpa = core.gpa }; + peer.* = .{ .peers = ps, .fd = fds[0], .id = 1, .view = .at(0), .dump = state, .blobs = blobs, .dump_gpa = core.gpa }; peer.welcome_len = (wire.encodeServer(&peer.welcome, .{ .welcome = .{ .pid = 1, .session = "t", .dump_len = whole, .blobs = @intCast(blobs.items.len) } }) catch unreachable).len; const Serve = struct { fn run(p: *Peer) void { @@ -5159,7 +5159,7 @@ test "a client that diverged joins again for its view: kept for it meanwhile, it const back = try joinedNow(a, 3, opened.view); defer back.deinit(); try std.testing.expectEqual(digestOf(a), back.digest()); - a.view_of[3] = opened.view; + a.view_of[3] = .at(opened.view); const u = try gpa.dupe(u8, try a.take(try back.input(.{ .key = .{ .cp = 'l', .text = "l" } }))); defer gpa.free(u); old.confirm(u); diff --git a/test/replicas.zig b/test/replicas.zig index 6a6d43b4..d78e3e02 100644 --- a/test/replicas.zig +++ b/test/replicas.zig @@ -1044,7 +1044,7 @@ const Soak = struct { // A Detach typed in a client's view, or one cut off for its lag: its // link shut, it hears its end and nothing after; its reader's end // said (the next boundary lets it go). - if (s.detach_view) |k| for (s.clients) |*cl| if (cl.peer) |p| if (p.view == k and !cl.shut) { + if (s.detach_view) |k| for (s.clients) |*cl| if (cl.peer) |p| if (p.view.index() == k and !cl.shut) { cl.shut = true; }; s.detach_view = null; @@ -1931,7 +1931,7 @@ fn flushAll(sc: *replica.Screens, core: *pardes.Pardes, ps: []const u16, list: * for (ps, 0..) |peer, c| { list.clearRetainingCapacity(); // Terminals alone cross: the view is not read. - try sc.flush(core, peer, 0, list); + try sc.flush(core, peer, list); for (list.items) |bytes| { tot.deltas += 1; tot.delta_bytes += bytes.len; -- cgit v1.3