summaryrefslogtreecommitdiff
path: root/core/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 23:49:29 -0300
committerGabriel Schneider <[email protected]>2026-11-19 01:35:13 -0300
commit1ca3e68f38385952fa5a2ccc3dac883ba0be71e8 (patch)
treebffbbf9e5e5b2b929d79bd81ea805c5288896623 /core/replica.zig
parente567aadc19f58b1e36098388483294321f3502dd (diff)
downloadpardes-1ca3e68f38385952fa5a2ccc3dac883ba0be71e8.tar.gz
pardes-1ca3e68f38385952fa5a2ccc3dac883ba0be71e8.zip
core: nothing of a core is a process global, the three that were (pardes-probes P3, the reorganisation's 12c): config.tab_now goes, a tab's width is the core's settings.tab handed to every width function as `tab` (File.graphemeDisplayWidth and the 73 functions above it, test helpers among them, that had no core to read it from gained the parameter; an Editor, a Surface and the hunks' Ctx carry it; render sets Surface.tab; graphemeDisplayWidth asks its one printable ASCII byte before the tab, the two disjoint: with the tab first, as before, the parameter cost 0.2-1.7% instructions an operation in pardes-perf, with ASCII first the measured cells use 2-16% fewer than the base), so a rollback can no longer leave a stale width and replica.zig's hand-made put-back in toConfirmed goes; Addon.distrusted/ndistrusted become Addon.Distrusted, the client's own list, which its frontend owns across its joins and hands each core as Options.distrusted (in no tape, dump or digest: Options' replica .local); Kind.draw_tokens becomes each slot's `draws` (local: a draw is a frame's, so each process's count differs and no digest may hold it; the copy saves it with the slot); the two turn reads in a step stay, being shown unable to reach a client's state (the report); the soak's Proc keeps only the client's list (its tab_now and the global swaps go, forced); test/perf.zig follows three signatures, so unit-test's perf check now says BaselineHarnessMismatch until the baselines are recorded again; tui core-test 824/966 (142 skipped), shell-test 1001/1004, pane-test 183/184, behaviour-test 274/274 and --replay 274/274, process-test 2 of 144 failed (lspcomplete, lspcompletemoved), replicas --clients 5 diverged 0 unequal 0 deltas wrong 0 quiet differ 0 at 30/80/207 ms, gui unit-test 1598/1602, lib-test, daemon.py plain, --far, --games, --window-clients pass
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/replica.zig')
-rw-r--r--core/replica.zig23
1 files changed, 11 insertions, 12 deletions
diff --git a/core/replica.zig b/core/replica.zig
index e4ed4e0a..8b63ed51 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -778,7 +778,7 @@ pub const Replica = struct {
// panes show a line.
c.kinds.ops = @splat(null);
for (c.panes, 0..) |pslot, at| if (pslot) |pane| if (pane.addon) |s| if (c.kinds.byName(s.nameOf())) |k| {
- if (c.kinds.ops[k] == null) c.kinds.ops[k] = pardes.Addon.plainOps(&c.kinds.kinds[k]);
+ if (c.kinds.ops[k] == null) c.kinds.ops[k] = pardes.Addon.plainOps(&c.kinds.kinds[k], o.distrusted);
// Refused (its file not here): the line saying it does not run here.
if (c.kinds.ops[k]) |ops| pane.addon = pardes.dump.plainHere(c, at, s, ops) catch s;
};
@@ -1060,9 +1060,6 @@ pub const Replica = struct {
// was there before is of a grid the deltas since moved on
// from (a rollback never brings a terminal's past back).
r.core().shell_rows = .{};
- // A tab's width is the process's (config.tab_now), which a
- // step that set it (Tab) wrote and the copy does not hold.
- pardes.config.tab_now = r.core().settings.tab;
}
r.applied = 0;
// Its views as the copy was taken, or as the last delta set them
@@ -3636,28 +3633,30 @@ test "the copy taken for an input of its own stays once the input is confirmed:
try std.testing.expectEqual(@as(u32, 1), r.stats.foreign);
}
-test "a rollback over a Tab it applied puts the process's tab width back as its core has it" {
- // config.tab_now is the process's, written by the step that set the
- // width (the soak, five clients: a Tab undone left it, and the next
- // replayed step measured the files' tabs otherwise).
+test "a rollback over a Tab it applied measures tabs as its core has them again" {
+ // A tab's width is the core's (settings.tab, handed to every width
+ // function), which the copy holds: once the process's (config.tab_now),
+ // a Tab undone left it, and the next replayed step measured the files'
+ // tabs otherwise (the soak, five clients).
const gpa = std.testing.allocator;
- defer pardes.config.tab_now = pardes.config.tab_width;
const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" }, TestHost.host(), false);
defer a.deinit();
const first = try gpa.dupe(u8, try a.unit(0, 0));
defer gpa.free(first);
const r = try Replica.init(gpa, 1, first, false);
defer r.deinit();
- pardes.config.tab_now = r.core().settings.tab;
const was = r.core().settings.tab;
const msg = try gpa.dupe(u8, try r.input(.{ .command = "Tab 2" }));
defer gpa.free(msg);
try std.testing.expectEqual(@as(usize, 1), r.applied);
- try std.testing.expectEqual(@as(u16, 2), pardes.config.tab_now);
+ try std.testing.expectEqual(@as(u16, 2), r.core().settings.tab);
// The session's own key first: back to the confirmed position.
r.confirm(try a.local(.{ .key = .{ .cp = 'l', .text = "l" } }));
try std.testing.expectEqual(was, r.core().settings.tab);
- try std.testing.expectEqual(was, pardes.config.tab_now);
+ r.settle();
+ r.confirm(try a.take(msg));
+ r.settle();
+ try agrees(a, r);
}
test "a delta applied under a speculation outlives its rollback: the terminal stays the authority's newest" {