summaryrefslogtreecommitdiff
path: root/test
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 /test
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 'test')
-rw-r--r--test/hxdiff.zig2
-rw-r--r--test/output.zig12
-rw-r--r--test/panes.zig92
-rw-r--r--test/perf.zig8
-rw-r--r--test/replicas.zig26
5 files changed, 64 insertions, 76 deletions
diff --git a/test/hxdiff.zig b/test/hxdiff.zig
index a368ba26..01169504 100644
--- a/test/hxdiff.zig
+++ b/test/hxdiff.zig
@@ -367,7 +367,7 @@ fn runCase(arena: std.mem.Allocator, case: Case, pane_kind: []const u8) !Result
pane.body.cur_row = 0;
pane.body.cur_col = 0;
pane.body.cur_pinned = true;
- pane.ensureCursorVisible();
+ pane.ensureCursorVisible(core.settings.tab);
}
} else fatal("case {s}: unknown pane {s}", .{ case.name, pane_kind });
diff --git a/test/output.zig b/test/output.zig
index d7b8a816..a8a1f239 100644
--- a/test/output.zig
+++ b/test/output.zig
@@ -70,7 +70,7 @@ fn outputCell(p: *Pardes, surface: *pardes.Surface, id: usize, byte: usize) *par
const pane = p.panes[id].?;
const line = modal.lineSlice(pane.file.?.content, 0);
const rect = p.view().rects[id];
- const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane) + @as(u16, @intCast(panes.File.displayWidth(line[0..byte])));
+ const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane) + @as(u16, @intCast(panes.File.displayWidth(p.settings.tab, line[0..byte])));
const y = p.bodyTop(pane, rect);
return surface.at(x, y);
}
@@ -444,7 +444,7 @@ test "Mini syntax colors survive themes and rendering without source access" {
// Direct pane construction bypasses the host update's layout sync.
p.update(.{ .resize = .{ .cols = 80, .rows = 24 } });
const position = modal.positionAt(mini.file.?.content, keyword);
- const column = panes.File.displayWidth(modal.lineSlice(mini.file.?.content, position.row)[0..position.col]);
+ const column = panes.File.displayWidth(config.tab_width, modal.lineSlice(mini.file.?.content, position.row)[0..position.col]);
try tmp.dir.deleteFile(std.testing.io, "demo.zig");
const colors = mini.file.?.mini.?.colors.ptr;
var frame = std.heap.ArenaAllocator.init(std.testing.allocator);
@@ -937,7 +937,7 @@ test "result alignment chunks keep seventeen matches independent and refresh sta
const index = 16 - reverse;
const label = try std.fmt.allocPrint(p.gpa, "/r{d:0>2}{s}.zig:3:1", .{ index, if (index == long_at) "-界-very-long-path-name" else "-é" });
defer p.gpa.free(label);
- widths[index] = panes.File.displayWidth(label);
+ widths[index] = panes.File.displayWidth(config.tab_width, label);
try input.appendSlice(p.gpa, label);
try input.appendSlice(p.gpa, " \t return 7;\n");
}
@@ -953,7 +953,7 @@ test "result alignment chunks keep seventeen matches independent and refresh sta
const first = index / 8 * 8;
var width: usize = 0;
for (widths[first..@min(first + 8, widths.len)]) |label_width| width = @max(width, label_width);
- try std.testing.expectEqual(width, panes.File.displayWidth(line[0 .. row.code_start - 1]));
+ try std.testing.expectEqual(width, panes.File.displayWidth(config.tab_width, line[0 .. row.code_start - 1]));
try std.testing.expectEqual(@as(u8, '\t'), line[row.code_start - 1]);
try std.testing.expectEqualStrings("\t return 7;", line[row.code_start..]);
try std.testing.expectEqualStrings(row.path, line[0 .. row.location_end - ":3:1".len]);
@@ -986,7 +986,7 @@ test "result alignment chunks keep seventeen matches independent and refresh sta
const label = line[0..row.location_end];
const code = line[row.code_start..];
try legacy.appendSlice(p.gpa, label);
- const padding = global_width - panes.File.displayWidth(label);
+ const padding = global_width - panes.File.displayWidth(config.tab_width, label);
try legacy.appendNTimes(p.gpa, ' ', padding);
try legacy.append(p.gpa, '\t');
try legacy.appendSlice(p.gpa, code);
@@ -1037,7 +1037,7 @@ test "result alignment chunks assign boundary context to nearest match with prev
const line = modal.lineSlice(file.content, index);
try std.testing.expectEqual(index + 1, row.at.line);
const expected = if (row.at.line <= 10) first_label else next_label;
- try std.testing.expectEqual(panes.File.displayWidth(expected), panes.File.displayWidth(line[0 .. row.code_start - 1]));
+ try std.testing.expectEqual(panes.File.displayWidth(config.tab_width, expected), panes.File.displayWidth(config.tab_width, line[0 .. row.code_start - 1]));
try std.testing.expectEqualStrings("\t source();", line[row.code_start..]);
if (row.at.line >= 9 and row.at.line != 12) {
try std.testing.expectEqual(.context, row.kind);
diff --git a/test/panes.zig b/test/panes.zig
index de9d3aea..378229ac 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -44,7 +44,7 @@ const TagLayerTests = struct {
const layer = try findLayer(p, .pane, 0);
const text = try pardes.tagline.tagText(p, frame.allocator(), pane);
const at = std.mem.indexOf(u8, text, "END").?;
- const col = panes.File.displayWidth(text[0..at]);
+ const col = panes.File.displayWidth(config.tab_width, text[0..at]);
try std.testing.expect(col > p.view().rects[0].w);
try std.testing.expect(col + 3 < layer.cols);
try std.testing.expectEqualStrings("E", layer.cells[col].grapheme());
@@ -107,7 +107,7 @@ const TagLayerTests = struct {
p.update(.{ .mouse = mouse(layer, beyond_x, .release) });
try std.testing.expectEqual(@as(usize, 0), p.view().active);
const end_col = left_layer.capacity(p.view().row_metrics) - 1;
- try std.testing.expectEqual(panes.File.rawAtDisplay(left_text, end_col), @as(usize, @intCast(left.tag.cur_col)));
+ try std.testing.expectEqual(panes.File.rawAtDisplay(config.tab_width, left_text, end_col), @as(usize, @intCast(left.tag.cur_col)));
try std.testing.expect(left.sel[0].state == .done and left.sel[0].r0 == 0);
p.update(.{ .key = .{ .cp = Key.escape } });
const long = &@as([60]u8, @splat('a')) ++ "界END";
@@ -171,7 +171,7 @@ const BodyHitTests = struct {
try std.testing.expectEqual(first.row, second.row);
const top = pane.scroll();
for ([_]u16{ 0, 1 }) |row| {
- const expected = pane.wrapAt(row).line;
+ const expected = pane.wrapAt(config.tab_width, row).line;
p.update(.{ .mouse = mouse(layer, row, 2, .press) });
p.update(.{ .mouse = mouse(layer, row, 2, .release) });
try std.testing.expectEqual(expected, pane.body.cur_row);
@@ -179,7 +179,7 @@ const BodyHitTests = struct {
}
const last = pane.body_visible_rows - 1;
try std.testing.expect(last >= pane.rows);
- const expected = pane.wrapAt(last).line;
+ const expected = pane.wrapAt(config.tab_width, last).line;
const prefix = panes.File.gutterWidth(pane);
p.update(.{ .mouse = mouse(layer, last - 1, prefix + 11, .press) });
// Release at a different source row without an intermediate drag event.
@@ -217,14 +217,14 @@ const LineNumberLookTests = struct {
// A header row's number is its declaration's own source line, not the
// body line it sits over (`pub fn work(` is line 1); a body row's is
// its own.
- try std.testing.expectEqual(@as(i32, 1), pane.wrapAt(1).line);
+ try std.testing.expectEqual(@as(i32, 1), pane.wrapAt(config.tab_width, 1).line);
const rows = [_]u16{ 1, pane.context_rows + 3 };
for (rows) |row| {
// Each Look recentres the view; come back under the headers.
pane.scrollBy(30 - pane.scroll());
_ = frame.reset(.retain_capacity);
_ = try p.render(frame.allocator());
- const expected = pane.wrapAt(row).line;
+ const expected = pane.wrapAt(config.tab_width, row).line;
var press = BodyHitTests.mouse(&p.surface.body_layers[0], row, 1, .press);
press.button = .right;
var release = BodyHitTests.mouse(&p.surface.body_layers[0], row, 1, .release);
@@ -274,7 +274,7 @@ const TreeContextTests = struct {
try std.testing.expectEqual(@as(u16, 4), layer.context_rows);
for ([_]i32{ 0, 4, 5, 6 }, 0..) |source_row, index| {
const row: u16 = @intCast(index);
- try std.testing.expectEqual(source_row, pane.wrapAt(row).line);
+ try std.testing.expectEqual(source_row, pane.wrapAt(config.tab_width, row).line);
try std.testing.expectEqual(index == 0 or index == 3, layer.hasContextBorderAfter(row));
const y = layer.rowTop(row, 20, 10) + 9.5;
const x = @as(f32, @floatFromInt(layer.viewport.x)) * 10 + 5;
@@ -304,10 +304,10 @@ const TreeContextTests = struct {
try std.testing.expectEqual(@as(usize, 0), p.view().active);
try std.testing.expectEqual(@as(i32, 59), pane.body.cur_row);
const surface = try p.render(frame.allocator());
- const visible = pane.wrapRow(pane.body.cur_row, pane.body.cur_col);
+ const visible = pane.wrapRow(config.tab_width, pane.body.cur_row, pane.body.cur_col);
try std.testing.expect(visible.row >= pane.context_rows);
try std.testing.expect(visible.row < pane.rows);
- try std.testing.expectEqual(@as(i32, 59), pane.wrapAt(visible.row).line);
+ try std.testing.expectEqual(@as(i32, 59), pane.wrapAt(config.tab_width, visible.row).line);
const cursor = surface.cursor orelse return error.MissingLookCursor;
const rect = p.view().rects[0];
const y = p.bodyTop(pane, rect);
@@ -330,8 +330,8 @@ const TreeContextTests = struct {
p.sync();
_ = try p.render(frame.allocator());
try std.testing.expectEqual(@as(u16, 4), pane.context_rows);
- for (0..4) |row| try std.testing.expectEqual(@as(i32, @intCast(row)), pane.wrapAt(@intCast(row)).line);
- try std.testing.expectEqual(@as(i32, 7), pane.wrapAt(pane.context_rows).line);
+ for (0..4) |row| try std.testing.expectEqual(@as(i32, @intCast(row)), pane.wrapAt(config.tab_width, @intCast(row)).line);
+ try std.testing.expectEqual(@as(i32, 7), pane.wrapAt(config.tab_width, pane.context_rows).line);
const rect = p.view().rects[0];
const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane);
const y = p.bodyTop(pane, rect);
@@ -357,10 +357,10 @@ const TreeContextTests = struct {
_ = try p.render(frame.allocator());
try std.testing.expect(pane.context_rows <= previous);
previous = pane.context_rows;
- try std.testing.expectEqual(pane.scroll(), pane.wrapAt(pane.context_rows).line);
+ try std.testing.expectEqual(pane.scroll(), pane.wrapAt(config.tab_width, pane.context_rows).line);
}
try std.testing.expectEqual(@as(u16, 0), pane.context_rows);
- try std.testing.expectEqual(@as(i32, 0), pane.wrapRow(0, pane.body.cur_col).row);
+ try std.testing.expectEqual(@as(i32, 0), pane.wrapRow(config.tab_width, 0, pane.body.cur_col).row);
try std.testing.expect(p.executeBuiltinLine(0, "TreeContext"));
pane.scrollBy(7);
_ = try p.render(frame.allocator());
@@ -403,7 +403,7 @@ const TreeContextTests = struct {
p.sync();
_ = try p.render(frame.allocator());
try std.testing.expectEqual(@as(u16, 0), pane.context_rows);
- try std.testing.expectEqual(pane.scroll(), pane.wrapAt(0).line);
+ try std.testing.expectEqual(pane.scroll(), pane.wrapAt(config.tab_width, 0).line);
}
test "TreeContext clipped headers leave wrapped body cursor coordinates intact" {
@@ -422,8 +422,8 @@ const TreeContextTests = struct {
p.sync();
const surface = try p.render(frame.allocator());
try std.testing.expectEqual(@as(u16, 1), pane.context_rows);
- try std.testing.expectEqual(@as(i32, 2), pane.wrapAt(1).line);
- try std.testing.expectEqual(@as(i32, 2), pane.wrapAt(2).line);
+ try std.testing.expectEqual(@as(i32, 2), pane.wrapAt(config.tab_width, 1).line);
+ try std.testing.expectEqual(@as(i32, 2), pane.wrapAt(config.tab_width, 2).line);
var target: ?struct { x: u16, y: u16 } = null;
for (0..surface.rows) |row| for (0..surface.cols) |col| {
if (std.mem.eql(u8, surface.at(@intCast(col), @intCast(row)).grapheme(), "界"))
@@ -817,8 +817,8 @@ const TagNameTintTests = struct {
var at: usize = 0;
while (at < line.len) : (at = modal.nextGrapheme(line, at)) {
const real = shown.toReal(line_start + at);
- const start: i32 = @intCast(panes.File.rawDisplayCol(line, at));
- const end = start + @as(i32, @intCast(panes.File.displayWidth(line[at..modal.nextGrapheme(line, at)])));
+ const start: i32 = @intCast(panes.File.rawDisplayCol(p.settings.tab, line, at));
+ const end = start + @as(i32, @intCast(panes.File.displayWidth(p.settings.tab, line[at..modal.nextGrapheme(line, at)])));
var col = start;
while (col < end and col < rect.w - pardes.TAG_TEXT_INSET) : (col += 1) {
const in_name = real > base and real < name.len;
@@ -868,7 +868,7 @@ const TagNameTintTests = struct {
defer arena.deinit();
const shown = try pardes.tagline.shownTag(p, arena.allocator(), pane);
const pos = modal.positionAt(shown.text, shown.fromReal(@intCast(pane.input.cur_col)));
- const col: i32 = @intCast(panes.File.rawDisplayCol(modal.lineSlice(shown.text, pos.row), pos.col));
+ const col: i32 = @intCast(panes.File.rawDisplayCol(config.tab_width, modal.lineSlice(shown.text, pos.row), pos.col));
pane.sel[0] = .{ .state = .done, .c0 = col, .c1 = col + 1, .r0 = @intCast(pos.row), .r1 = @intCast(pos.row) };
const surface = try p.render(arena.allocator());
const x = p.view().rects[0].x + pardes.TAG_TEXT_INSET + @as(u16, @intCast(col));
@@ -1624,33 +1624,33 @@ const FileTests = struct {
test "display columns map complete Unicode graphemes" {
const text = "é界e\u{301}x";
- try std.testing.expectEqual(@as(usize, 5), displayWidth(text));
- try std.testing.expectEqual(@as(usize, 0), byteAtDisplay(text, 0));
- try std.testing.expectEqual(@as(usize, 2), byteAtDisplay(text, 1));
- try std.testing.expectEqual(@as(usize, 2), byteAtDisplay(text, 2));
- try std.testing.expectEqual(@as(usize, 5), byteAtDisplay(text, 3));
- try std.testing.expectEqual(@as(usize, 8), byteAtDisplay(text, 4));
- try std.testing.expectEqual(text.len, byteAtDisplay(text, 5));
- try std.testing.expectEqual(@as(usize, 3), rawDisplayCol(text, 5));
- try std.testing.expectEqual(@as(usize, 5), rawAtDisplay(text, 3));
+ try std.testing.expectEqual(@as(usize, 5), displayWidth(config.tab_width, text));
+ try std.testing.expectEqual(@as(usize, 0), byteAtDisplay(config.tab_width, text, 0));
+ try std.testing.expectEqual(@as(usize, 2), byteAtDisplay(config.tab_width, text, 1));
+ try std.testing.expectEqual(@as(usize, 2), byteAtDisplay(config.tab_width, text, 2));
+ try std.testing.expectEqual(@as(usize, 5), byteAtDisplay(config.tab_width, text, 3));
+ try std.testing.expectEqual(@as(usize, 8), byteAtDisplay(config.tab_width, text, 4));
+ try std.testing.expectEqual(text.len, byteAtDisplay(config.tab_width, text, 5));
+ try std.testing.expectEqual(@as(usize, 3), rawDisplayCol(config.tab_width, text, 5));
+ try std.testing.expectEqual(@as(usize, 5), rawAtDisplay(config.tab_width, text, 3));
// At the line's end and past it (virtual columns, one byte each).
- try std.testing.expectEqual(text.len, rawAtDisplay(text, 5));
- try std.testing.expectEqual(text.len + 2, rawAtDisplay(text, 7));
- try std.testing.expectEqual(@as(usize, 2), graphemeDisplayWidth("👩\u{200d}🚀"));
+ try std.testing.expectEqual(text.len, rawAtDisplay(config.tab_width, text, 5));
+ try std.testing.expectEqual(text.len + 2, rawAtDisplay(config.tab_width, text, 7));
+ try std.testing.expectEqual(@as(usize, 2), graphemeDisplayWidth(config.tab_width, "👩\u{200d}🚀"));
}
test "visual rows partition a line at the breaks the body renders" {
const line = "abcdefgh";
- try std.testing.expectEqual(VisualRow{ .start = 0, .end = line.len }, visualRow(line, 5, 0));
- try std.testing.expectEqual(VisualRow{ .start = 0, .end = 3 }, visualRow(line, 0, 3));
- try std.testing.expectEqual(VisualRow{ .start = 0, .end = 3 }, visualRow(line, 2, 3));
- try std.testing.expectEqual(VisualRow{ .start = 3, .end = 6 }, visualRow(line, 3, 3));
+ try std.testing.expectEqual(VisualRow{ .start = 0, .end = line.len }, visualRow(config.tab_width, line, 5, 0));
+ try std.testing.expectEqual(VisualRow{ .start = 0, .end = 3 }, visualRow(config.tab_width, line, 0, 3));
+ try std.testing.expectEqual(VisualRow{ .start = 0, .end = 3 }, visualRow(config.tab_width, line, 2, 3));
+ try std.testing.expectEqual(VisualRow{ .start = 3, .end = 6 }, visualRow(config.tab_width, line, 3, 3));
// Past the end (a cursor on the newline) names the LAST row, and a short
// line is one row however narrow the pane is.
- try std.testing.expectEqual(VisualRow{ .start = 6, .end = 8 }, visualRow(line, line.len, 3));
- try std.testing.expectEqual(VisualRow{ .start = 0, .end = 0 }, visualRow("", 0, 3));
+ try std.testing.expectEqual(VisualRow{ .start = 6, .end = 8 }, visualRow(config.tab_width, line, line.len, 3));
+ try std.testing.expectEqual(VisualRow{ .start = 0, .end = 0 }, visualRow(config.tab_width, "", 0, 3));
// A grapheme wider than the row still occupies exactly one row.
- try std.testing.expectEqual(VisualRow{ .start = 0, .end = 4 }, visualRow("👩x", 0, 1));
+ try std.testing.expectEqual(VisualRow{ .start = 0, .end = 4 }, visualRow(config.tab_width, "👩x", 0, 1));
}
};
@@ -1674,7 +1674,7 @@ const OutputTests = struct {
for (file.location_rows, 0..) |row, i| {
const line = modal.lineSlice(file.content, i);
try std.testing.expectEqual(.match, row.kind);
- const current = panes.File.displayWidth(line[0..row.code_start]);
+ const current = panes.File.displayWidth(config.tab_width, line[0..row.code_start]);
if (column) |previous| try std.testing.expectEqual(previous, current);
column = current;
const expected = if (std.mem.eql(u8, row.path, "/界.zig")) " first" else "\tsecond";
@@ -1696,7 +1696,7 @@ const OutputTests = struct {
try std.testing.expectEqual(@as(usize, 3), file.location_rows.len);
const match = file.location_rows[1];
const match_line = modal.lineSlice(file.content, 1);
- const alignment = panes.File.displayWidth(match_line[0..match.code_start]);
+ const alignment = panes.File.displayWidth(config.tab_width, match_line[0..match.code_start]);
try std.testing.expect(match.location_end > 0);
try std.testing.expect(std.mem.startsWith(u8, match_line, path));
for (file.location_rows, 0..) |row, index| {
@@ -1704,7 +1704,7 @@ const OutputTests = struct {
try std.testing.expectEqualStrings(path, row.path);
try std.testing.expectEqual(index + 1, row.at.line);
try std.testing.expect(!row.declaration);
- try std.testing.expectEqual(alignment, panes.File.displayWidth(line[0..row.code_start]));
+ try std.testing.expectEqual(alignment, panes.File.displayWidth(config.tab_width, line[0..row.code_start]));
try std.testing.expectEqualStrings(modal.lineSlice(source, index), line[row.code_start..]);
if (index != 1) {
try std.testing.expectEqual(@as(usize, 0), row.location_end);
@@ -1834,11 +1834,11 @@ const OutputTests = struct {
defer frame.deinit();
_ = try p.render(frame.allocator());
const wrapped = for (0..result.wrap_n) |vr| {
- const w = result.wrapAt(@intCast(vr));
+ const w = result.wrapAt(config.tab_width, @intCast(vr));
if (w.line == 0 and w.pad > 0 and w.at < file.location_rows[0].location_end) break vr;
} else return error.MissingWrappedLocation;
- const w = result.wrapAt(@intCast(wrapped));
- const shown = try panes.File.bodyText(frame.allocator(), result, file);
+ const w = result.wrapAt(config.tab_width, @intCast(wrapped));
+ const shown = try panes.File.bodyText(config.tab_width, frame.allocator(), result, file);
const shown_line = modal.lineSlice(shown, wrapped);
try std.testing.expect(std.mem.startsWith(u8, shown_line[panes.File.gutterWidth(result)..], "│ │ "));
const rect = p.view().rects[result_id];
@@ -1990,7 +1990,7 @@ const OutputTests = struct {
var alignment: ?usize = null;
for (file.location_rows, 0..) |row, index| {
const line = modal.lineSlice(file.content, index);
- const width = panes.File.displayWidth(line[0..row.code_start]);
+ const width = panes.File.displayWidth(config.tab_width, line[0..row.code_start]);
if (alignment) |previous| try std.testing.expectEqual(previous, width);
alignment = width;
try std.testing.expect(!std.mem.startsWith(u8, line, "| "));
@@ -2055,7 +2055,7 @@ const OutputTests = struct {
for (file.highlights[start + row.code_start .. start + line.len]) |style|
try std.testing.expectEqual(@as(u8, 0), style);
const local = std.mem.indexOfNone(u8, line[row.code_start..], " \t") orelse continue;
- const x = rect.x + config.GUTTER + panes.File.gutterWidth(result) + @as(u16, @intCast(panes.File.displayWidth(line[0 .. row.code_start + local])));
+ const x = rect.x + config.GUTTER + panes.File.gutterWidth(result) + @as(u16, @intCast(panes.File.displayWidth(config.tab_width, line[0 .. row.code_start + local])));
const y = body_y + @as(u16, @intCast(index));
const cell = surface.at(x, y);
try std.testing.expect(!cell.style.bold);
diff --git a/test/perf.zig b/test/perf.zig
index c52c1715..17df0bdc 100644
--- a/test/perf.zig
+++ b/test/perf.zig
@@ -605,7 +605,7 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u
longLine(core, pane.serial);
pump(core);
const len: u32 = @intCast(pane.file.?.content.len);
- pardes.ctlfs.pane.setDot(pane, .{ .q0 = len - 10, .q1 = len - 5 });
+ pardes.ctlfs.pane.setDot(core.settings.tab, pane, .{ .q0 = len - 10, .q1 = len - 5 });
pump(core);
}
@@ -719,7 +719,7 @@ fn measureTerm(op: TermOp, fx: TermFixture, reps: usize) !Cell {
pane.body.cur_col = 0;
pane.body.cur_pinned = true;
pane.body.sticky_col = -1;
- pane.ensureCursorVisible();
+ pane.ensureCursorVisible(core.settings.tab);
_ = try frame(core);
}
const before = .{
@@ -1580,7 +1580,7 @@ fn miniMeasurement(fallback: std.mem.Allocator, probe: MiniProbe, path: []const
else
styles;
defer if (probe == .highlight_generate) syntax_allocator.free(highlighted);
- const converted = try pardes.panes.mini.generate(allocator, source, highlighted);
+ const converted = try pardes.panes.mini.generate(pardes.config.tab_width, allocator, source, highlighted);
const elapsed = nowNs() - begin;
defer converted.deinit(allocator);
if (index == 0) result.cold_ns = elapsed else samples[index - 1] = elapsed;
@@ -1636,7 +1636,7 @@ fn measureMini(io: std.Io, fallback: std.mem.Allocator, reps: usize, json: bool)
defer gpa.free(styles);
if (styles.len != source.len or std.mem.indexOfScalar(u8, styles, @backingInt(pardes.syntax.Syn.comment)) == null)
return error.MiniSyntaxUnavailable;
- const expected = try pardes.panes.mini.generate(gpa, source, styles);
+ const expected = try pardes.panes.mini.generate(pardes.config.tab_width, gpa, source, styles);
defer expected.deinit(gpa);
if (expected.content.len == 0 or expected.content.len != expected.colors.len or !std.unicode.utf8ValidateSlice(expected.content))
return error.InvalidMiniOutput;
diff --git a/test/replicas.zig b/test/replicas.zig
index a122ac9f..d9834209 100644
--- a/test/replicas.zig
+++ b/test/replicas.zig
@@ -407,29 +407,17 @@ fn screenHash(t: *screen_state.Terminal) u64 {
return h.hasher.final();
}
-/// A process's own globals, where the soak runs the session and every
-/// client in one: a step writes `config.tab_now` from its core's settings
-/// (exec.zig's Tab, a dump's load), which a client's process and the
-/// session's each hold apart. Shared, one core's rollback that left it
-/// stale would leave the other cores reading it too, and agree. And the
-/// kinds a client caught breaking PA_PLAIN (Addon.distrust): shared, one
-/// client's catch would leave every other without the kind's code at its
-/// next join, never to run it (and diverge) again.
+/// What a client's process holds apart from the session's, where the soak
+/// runs them all in one: the kinds it caught breaking PA_PLAIN, handed to
+/// each core it joins with (`Options.distrusted`). No process global stands
+/// in for a core's state any more (the tab's width is the core's): `enter`
+/// and `current` are left for the loops' rewrite to delete.
const Proc = struct {
- tab_now: u16 = pardes.config.tab_width,
- distrusted: @TypeOf(pardes.Addon.distrusted) = undefined,
- ndistrusted: usize = 0,
+ distrusted: pardes.Addon.Distrusted = .{},
var current: ?*Proc = null;
fn enter(p: *Proc) void {
- if (current == p) return;
- if (current) |was| {
- was.tab_now = pardes.config.tab_now;
- was.distrusted, was.ndistrusted = .{ pardes.Addon.distrusted, pardes.Addon.ndistrusted };
- }
- pardes.config.tab_now = p.tab_now;
- pardes.Addon.distrusted, pardes.Addon.ndistrusted = .{ p.distrusted, p.ndistrusted };
current = p;
}
};
@@ -1115,7 +1103,7 @@ fn run(r: Run, dir: []const u8, totals: *Totals) !void {
try totals.add(&old.stats);
old.deinit();
}
- const rp = try replica.Replica.initDump(gpa, cl.id, cl.view, m.bytes, .{ .cols = cl.cols, .rows = cl.rows });
+ const rp = try replica.Replica.initDump(gpa, cl.id, cl.view, m.bytes, .{ .cols = cl.cols, .rows = cl.rows, .distrusted = &cl.proc.distrusted });
cl.r = rp;
rp.stats.samples = true;
rp.t.local_files = true;