summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--abi/pardes.h2
-rw-r--r--build.zig2
-rw-r--r--build/tests.zig2
-rw-r--r--build/tools.zig16
-rw-r--r--core/CHANGELOG.md6
-rw-r--r--core/Core.zig2
-rw-r--r--core/Handover.zig14
-rw-r--r--core/Pipe.zig36
-rw-r--r--core/Query.zig18
-rw-r--r--core/Store.zig8
-rw-r--r--core/builtins.zig4
-rw-r--r--core/colors.zig7
-rw-r--r--core/echo.zig2
-rw-r--r--core/layout.zig90
-rw-r--r--core/lsp/Ask.zig39
-rw-r--r--core/panes.zig8
-rw-r--r--core/replica.zig40
-rw-r--r--dev/file_watch.zig6
-rw-r--r--dev/macos/Sources/AppDelegate.swift4
-rw-r--r--docs/next-daemon.md2
-rw-r--r--docs/next-drag.md6
-rw-r--r--docs/search-proto-converge.md8
-rw-r--r--docs/typ/building.typ4
-rw-r--r--runtime/macos.zig36
-rw-r--r--test/consumer/build.zig2
-rw-r--r--test/macos_e2e.swift4
-rw-r--r--test/replicas.zig4
27 files changed, 186 insertions, 186 deletions
diff --git a/abi/pardes.h b/abi/pardes.h
index ca65b8f3..24eb6701 100644
--- a/abi/pardes.h
+++ b/abi/pardes.h
@@ -223,7 +223,7 @@ typedef struct {
// core defers each shell's greeting until it has seen one), and the first
// forkpty takes its winsize straight off the core — boot at 80x24 and the
// shell draws its first prompt to a width the window never had.
-int pardes_init(const pardes_callbacks_s *runtime, uint16_t cols, uint16_t rows);
+int pardes_init(const pardes_callbacks_s *callbacks, uint16_t cols, uint16_t rows);
void pardes_deinit(void);
// Drain pty output into the core and perform the effects it queued. Call after
diff --git a/build.zig b/build.zig
index 125f4dcc..470d8600 100644
--- a/build.zig
+++ b/build.zig
@@ -33,7 +33,7 @@
//! such a package fetches what it asked for and nothing else.
//! `pardes-editor` has `pardes-syntax` in it as `.syntax`: a file belongs
//! to one module, so a package imports one of the two. `test/consumer` is
-//! such a package, with both shapes; `lib-test`, which `unit-test` runs,
+//! such a package, with both shapes; `consumer-test`, which `unit-test` runs,
//! builds and runs it.
const std = @import("std");
const builtin = @import("builtin");
diff --git a/build/tests.zig b/build/tests.zig
index 741eb24a..e0b33911 100644
--- a/build/tests.zig
+++ b/build/tests.zig
@@ -62,7 +62,7 @@ pub fn add(b: *std.Build, c: struct {
// The perf gate runs with every unit-test (a regression like a
// contrast search per grapheme costs 100x, far past the gate).
unit_step.dependOn(c.tools.perf_gate_step);
- unit_step.dependOn(c.tools.lib_test_step);
+ unit_step.dependOn(c.tools.consumer_test_step);
const units: Units = .{ .nonce = c.test_nonce, .build = c.test_build, .unit = unit_step, .match = testMatch(b, c.unit_profile, c.test_filters, unit_step), .profiler = c.unit_profile, .filters = c.test_filters, .target = c.target, .optimize = c.optimize };
// The perf and fs bench programs' own tests: they compile no editor.
_ = units.add(b, units.root(b, "test/perf.zig", true, &.{.{ .name = "perf_options", .module = c.tools.perf_options.createModule() }}), null);
diff --git a/build/tools.zig b/build/tools.zig
index 2ed0e57e..e573b16d 100644
--- a/build/tools.zig
+++ b/build/tools.zig
@@ -16,7 +16,7 @@ pub const Tools = struct {
perf_gate_step: *std.Build.Step,
/// The perf program's build identity, which its own tests read too.
perf_options: *std.Build.Step.Options,
- lib_test_step: *std.Build.Step,
+ consumer_test_step: *std.Build.Step,
};
/// The harnesses, the helix comparisons, the benches and the perf gate, the
@@ -243,12 +243,12 @@ pub fn add(b: *std.Build, c: struct {
// The library as a package that depends on pardes is given it
// (`library`): test/consumer's own `zig build test`, over the packages
// this checkout has fetched.
- const lib_test = b.addSystemCommand(&.{ b.graph.zig_exe, "build", "test", "--pkg-dir", "../../zig-pkg" });
- lib_test.setName("zig build test in test/consumer, a package that depends on pardes");
- lib_test.setCwd(b.path("test/consumer"));
- lib_test.has_side_effects = true;
- const lib_test_step = b.step("lib-test", "build and test the library from a package that depends on pardes (test/consumer)");
- lib_test_step.dependOn(&lib_test.step);
+ const consumer_test = b.addSystemCommand(&.{ b.graph.zig_exe, "build", "test", "--pkg-dir", "../../zig-pkg" });
+ consumer_test.setName("zig build test in test/consumer, a package that depends on pardes");
+ consumer_test.setCwd(b.path("test/consumer"));
+ consumer_test.has_side_effects = true;
+ const consumer_test_step = b.step("consumer-test", "build and test the library from a package that depends on pardes (test/consumer)");
+ consumer_test_step.dependOn(&consumer_test.step);
const history = b.addExecutable(.{
.name = "pardes-history",
@@ -262,7 +262,7 @@ pub fn add(b: *std.Build, c: struct {
run_history.addPassthruArgs();
run_history.has_side_effects = true;
b.step("history", "compare command output and test/build runtime across jj revisions").dependOn(&run_history.step);
- return .{ .perf_gate_step = perf_gate_step, .perf_options = perf_options, .lib_test_step = lib_test_step };
+ return .{ .perf_gate_step = perf_gate_step, .perf_options = perf_options, .consumer_test_step = consumer_test_step };
}
/// The PDF benches: the core over the pdf addon, a pane of it.
diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md
index e5d592bb..49bc105f 100644
--- a/core/CHANGELOG.md
+++ b/core/CHANGELOG.md
@@ -249,9 +249,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,
diff --git a/core/Core.zig b/core/Core.zig
index 98e2e407..55b3682f 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/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/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/Query.zig b/core/Query.zig
index 663095b0..3a5aa5f8 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/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/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/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/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 <why>`).
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/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/core/replica.zig b/core/replica.zig
index 0b554ed5..de58da94 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 daemon.sessionState() == .pair) 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) {
daemon.keepSession();
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/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/dev/macos/Sources/AppDelegate.swift b/dev/macos/Sources/AppDelegate.swift
index 4168999f..5ee775cf 100644
--- a/dev/macos/Sources/AppDelegate.swift
+++ b/dev/macos/Sources/AppDelegate.swift
@@ -132,7 +132,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate {
// to change the day macos_min_version reaches 14.
NSApp.activate(ignoringOtherApps: true)
- var runtime = pardes_callbacks_s(
+ var callbacks = pardes_callbacks_s(
userdata: Unmanaged.passUnretained(self).toOpaque(),
wakeup: { ud in
// A pty reader thread. Every other function in pardes.h is
@@ -168,7 +168,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate {
// greeting until it has seen a size, so a correction sent afterwards
// arrives with the first prompt already wrapped to the wrong width.
let grid = view.gridSize
- let rc = pardes_init(&runtime, grid.cols, grid.rows)
+ let rc = pardes_init(&callbacks, grid.cols, grid.rows)
if rc != 0 {
NSLog("pardes: the core failed to boot at \(grid.cols)x\(grid.rows), pardes_init returned \(rc)")
// Not NSApp.terminate — that runs applicationWillTerminate, which
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
diff --git a/docs/typ/building.typ b/docs/typ/building.typ
index 1eb0f9b5..94939452 100644
--- a/docs/typ/building.typ
+++ b/docs/typ/building.typ
@@ -129,7 +129,7 @@ Every dependency but tree-sitter's runtime is lazy in the manifest, so
such a package fetches what it asked for and nothing else.
`pardes-editor` has `pardes-syntax` in it as `.syntax`: a file belongs
to one module, so a package imports one of the two. `test/consumer` is
-such a package, with both shapes; `lib-test`, which `unit-test` runs,
+such a package, with both shapes; `consumer-test`, which `unit-test` runs,
builds and runs it.
`build.zig.zon` names pardes by its path: `.pardes = .{ .path = "../pardes" }`.
@@ -198,7 +198,7 @@ zig build kitty-harness kitty graphics through a pane end to end (a fake kitt
terminal outside on the tui, the GPU capture on the gui;
kitten icat and chafa too when installed)
zig build syntax deterministic per-byte highlighting snapshots
-zig build lib-test the library, from a package that depends on pardes (test/consumer);
+zig build consumer-test the library, from a package that depends on pardes (test/consumer);
unit-test runs it too
zig build hxlib helix's cases on the library's editor (-- --parity: against the file pane)
zig build behaviour-test behaviour through the 9P tree, in process (test/behaviour/),
diff --git a/runtime/macos.zig b/runtime/macos.zig
index 4f9a9c33..88eab2bb 100644
--- a/runtime/macos.zig
+++ b/runtime/macos.zig
@@ -250,7 +250,7 @@ const State = struct {
io: std.Io,
core: *pardes.Pardes,
started: bool = false,
- runtime: Callbacks,
+ callbacks: Callbacks,
tag_cells: [pardes.MAX_TAG_LAYERS][]Cell = @splat(&.{}),
layer_cells: [pardes.MAX_PANES][]Cell = @splat(&.{}),
cells: []Cell = &.{},
@@ -290,9 +290,9 @@ const State = struct {
var state: ?State = null;
-export fn pardes_init(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) c_int {
+export fn pardes_init(callbacks: ?*const Callbacks, cols_arg: u16, rows_arg: u16) c_int {
if (state != null) return 1; // already up; deinit first
- initCore(runtime, cols_arg, rows_arg) catch |err| {
+ initCore(callbacks, cols_arg, rows_arg) catch |err| {
log.err("init failed: {t}", .{err});
return 2;
};
@@ -302,7 +302,7 @@ export fn pardes_init(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16)
/// The shell's gpa in a Debug build, as std.start's is for the others.
var debug_gpa: std.heap.DebugAllocator(.{}) = .init;
-fn initCore(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) !void {
+fn initCore(callbacks: ?*const Callbacks, cols_arg: u16, rows_arg: u16) !void {
// The allocator every other shell gets from std.start: a DebugAllocator
// in Debug, libc's malloc otherwise. libc's measured at least as fast as
// std.heap.smp_allocator everywhere and faster on MuPDF's page-sized
@@ -373,7 +373,7 @@ fn initCore(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) !void {
.core = core,
.config_arena = config_arena,
.prompt_rcs = prompt_rcs,
- .runtime = if (runtime) |r| r.* else .{},
+ .callbacks = if (callbacks) |c| c.* else .{},
};
const st = &state.?;
st.inbox = .{ .gpa = gpa, .lsp_allocator = gpa, .io = io, .wake_fn = wakeHost, .wake_ctx = st };
@@ -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;
}
@@ -1758,14 +1758,14 @@ fn dumpThemes(ctx: ?*anyopaque, id: pardes.Pane.Id) void {
fn setClipboard(ctx: ?*anyopaque, text: []const u8) void {
const st = hostState(ctx);
- const cb = st.runtime.set_clipboard orelse return;
- cb(st.runtime.userdata, text.ptr, text.len);
+ const cb = st.callbacks.set_clipboard orelse return;
+ cb(st.callbacks.userdata, text.ptr, text.len);
}
fn readClipboard(ctx: ?*anyopaque) void {
const st = hostState(ctx);
- const cb = st.runtime.read_clipboard orelse return;
- cb(st.runtime.userdata);
+ const cb = st.callbacks.read_clipboard orelse return;
+ cb(st.callbacks.userdata);
}
fn openLink(_: ?*anyopaque, url: []const u8) void {
@@ -1803,9 +1803,9 @@ fn wakeHost(ctx: ?*anyopaque) void {
}
fn wake(st: *State) void {
- const cb = st.runtime.wakeup orelse return;
+ const cb = st.callbacks.wakeup orelse return;
if (st.wake_pending.swap(true, .acq_rel)) return;
- cb(st.runtime.userdata);
+ cb(st.callbacks.userdata);
}
fn captureEnv(arena: std.mem.Allocator) ?std.process.Environ.Map {
@@ -2058,7 +2058,7 @@ test "mac queued results never cancel a newer LSP request" {
.threaded = undefined,
.io = std.testing.io,
.core = core,
- .runtime = .{},
+ .callbacks = .{},
.config_arena = .init(gpa),
.prompt_rcs = .{},
.inbox = .{ .gpa = gpa, .lsp_allocator = gpa, .io = std.testing.io },
@@ -2101,7 +2101,7 @@ test "mac worker setup failures finish matching LSP and pipe requests" {
.threaded = undefined,
.io = failing_io,
.core = core,
- .runtime = .{},
+ .callbacks = .{},
.config_arena = .init(gpa),
.prompt_rcs = .{},
.inbox = .{ .gpa = failing.allocator(), .lsp_allocator = failing.allocator(), .io = failing_io },
@@ -2224,7 +2224,7 @@ test "mac Restore keeps host state and rejects callbacks from the old core" {
.threaded = undefined,
.io = std.testing.io,
.core = core,
- .runtime = .{},
+ .callbacks = .{},
.config_arena = .init(gpa),
.prompt_rcs = .{},
.inbox = .{ .gpa = gpa, .lsp_allocator = gpa, .io = std.testing.io },
@@ -2325,7 +2325,7 @@ test "mac Restore cancels a PTY reader waiting for output capacity" {
.threaded = undefined,
.io = io,
.core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }),
- .runtime = .{},
+ .callbacks = .{},
.config_arena = .init(gpa),
.prompt_rcs = .{},
.inbox = .{ .gpa = gpa, .lsp_allocator = gpa, .io = io },
@@ -2627,7 +2627,7 @@ test "mac row metrics ABI preserves PDF cell dimensions and the unrendered grid"
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 });
defer core.deinit();
- state = .{ .gpa = gpa, .threaded = undefined, .io = std.testing.io, .core = core, .runtime = .{}, .config_arena = .init(gpa), .prompt_rcs = .{} };
+ state = .{ .gpa = gpa, .threaded = undefined, .io = std.testing.io, .core = core, .callbacks = .{}, .config_arena = .init(gpa), .prompt_rcs = .{} };
defer {
state.?.config_arena.deinit();
state = null;
@@ -2646,7 +2646,7 @@ test "mac tag layer ABI preserves logical capacity and physical grip" {
const gpa = std.testing.allocator;
const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 8, .rows = 3 });
defer core.deinit();
- state = .{ .gpa = gpa, .threaded = undefined, .io = std.testing.io, .core = core, .runtime = .{}, .config_arena = .init(gpa), .prompt_rcs = .{} };
+ state = .{ .gpa = gpa, .threaded = undefined, .io = std.testing.io, .core = core, .callbacks = .{}, .config_arena = .init(gpa), .prompt_rcs = .{} };
defer {
for (state.?.tag_cells) |cells| gpa.free(cells);
state.?.config_arena.deinit();
diff --git a/test/consumer/build.zig b/test/consumer/build.zig
index ca63bb6e..c643bfb3 100644
--- a/test/consumer/build.zig
+++ b/test/consumer/build.zig
@@ -1,5 +1,5 @@
//! A package that depends on pardes, as a program would (build.zig's head
-//! comment has its lines): pardes's `lib-test`, which `unit-test` runs,
+//! comment has its lines): pardes's `consumer-test`, which `unit-test` runs,
//! runs `zig build test` here. `pardes-syntax` with the minimal grammars,
//! as a program that draws source text itself takes it; and
//! `pardes-editor` with no grammar of pardes's and one of its own, C's,
diff --git a/test/macos_e2e.swift b/test/macos_e2e.swift
index 38d27808..25d83957 100644
--- a/test/macos_e2e.swift
+++ b/test/macos_e2e.swift
@@ -168,7 +168,7 @@ private final class Driver: PardesViewDelegate {
message: "the view measured \(got.cols)x\(got.rows) cells, not the \(cols)x\(rows) the script asked for")
}
- var runtime = pardes_callbacks_s(
+ var callbacks = pardes_callbacks_s(
userdata: Unmanaged.passUnretained(host).toOpaque(),
wakeup: { ud in
// A pty reader thread. One flag and out — see Host.woke.
@@ -200,7 +200,7 @@ private final class Driver: PardesViewDelegate {
text.withCString { pardes_paste($0, text.utf8.count) }
})
- let rc = pardes_init(&runtime, got.cols, got.rows)
+ let rc = pardes_init(&callbacks, got.cols, got.rows)
guard rc == 0 else {
throw ScriptError(message: "pardes_init returned \(rc) at \(cols)x\(rows)")
}
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;