summaryrefslogtreecommitdiff
path: root/core/Places.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/Places.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/Places.zig')
-rw-r--r--core/Places.zig26
1 files changed, 13 insertions, 13 deletions
diff --git a/core/Places.zig b/core/Places.zig
index 9b8754b9..1416dbd3 100644
--- a/core/Places.zig
+++ b/core/Places.zig
@@ -433,7 +433,7 @@ pub fn fill(set: *Places, p: *Pardes, pane: *Pane, bytes: usize, steps: u64) voi
}
if (set.fold and (set.hay_revision != f.revision or set.hay.len != f.content.len))
if (!set.freshHay(gpa, f)) return set.clear(gpa);
- if (set.re == null) return set.settleSeek(pane);
+ if (set.re == null) return set.settleSeek(p.settings.tab, pane);
const re = &set.re.?;
const hay: []const u8 = if (set.fold) set.hay else f.content;
for (re.branches) |*b| b.re.steps = @max(1, steps / re.branches.len);
@@ -506,12 +506,12 @@ pub fn fill(set: *Places, p: *Pardes, pane: *Pane, bytes: usize, steps: u64) voi
set.gen +%= 1;
set.hits_gen +%= 1;
}
- set.settleSeek(pane);
+ set.settleSeek(p.settings.tab, pane);
}
/// The place at or after `seek` becomes current, once all the text
/// between them has been searched (never a false "next" across a gap).
-fn settleSeek(set: *Places, pane: *Pane) void {
+fn settleSeek(set: *Places, tab: u16, pane: *Pane) void {
const seek = set.seek orelse return;
const hits = set.hits.items;
const i = firstFrom(hits, seek);
@@ -525,10 +525,10 @@ fn settleSeek(set: *Places, pane: *Pane) void {
set.seek = null;
set.gen +%= 1;
if (!set.seek_moves) return;
- if (set.current) |c| return set.goTo(pane, c, false);
+ if (set.current) |c| return set.goTo(tab, pane, c, false);
// Nothing matches: the body as it was before the query, as helix
// leaves it.
- set.restore(pane);
+ set.restore(tab, pane);
}
/// The places have more to do on a frame of their own: places still to
@@ -542,7 +542,7 @@ pub fn busy(set: *const Places, pane: *const Pane) bool {
/// Make place `i` current: the primary selection on it (a new one beside
/// the others in select mode, `add`), the view on it, centred when it was
/// off it.
-pub fn goTo(set: *Places, pane: *Pane, i: usize, add: bool) void {
+pub fn goTo(set: *Places, tab: u16, pane: *Pane, i: usize, add: bool) void {
const f = if (pane.file) |*file| file else return;
if (i >= set.hits.items.len) return;
const t = &pane.body;
@@ -557,17 +557,17 @@ pub fn goTo(set: *Places, pane: *Pane, i: usize, add: bool) void {
.{ .anchor = h.start, .head = h.end };
if (add and got.n < ranges.len) {
ranges[got.n] = next;
- t.setRanges(text, ranges[0 .. got.n + 1], &.{}, got.n, true);
+ t.setRanges(tab, text, ranges[0 .. got.n + 1], &.{}, got.n, true);
} else {
ranges[got.pri] = next;
- t.setRanges(text, ranges[0..got.n], &.{}, got.pri, true);
+ t.setRanges(tab, text, ranges[0..got.n], &.{}, got.pri, true);
}
set.current = i;
set.gen +%= 1;
const off = pane.scroll();
if (t.cur_row < off or t.cur_row >= off + @as(i32, pane.rows))
pane.scrollBy(t.cur_row - off - @divTrunc(@as(i32, pane.rows), 2));
- t.show();
+ t.show(tab);
}
/// n and N (and Ctrl-n, Ctrl-p on a query's line): the next place after
@@ -596,7 +596,7 @@ pub fn step(set: *Places, p: *Pardes, pane: *Pane, forward: bool, count: u32, ad
while (i > 0 and hits[i - 1].end > from) i -= 1;
i = if (i == 0) hits.len - 1 else i - 1;
}
- set.goTo(pane, i, add);
+ set.goTo(p.settings.tab, pane, i, add);
}
}
@@ -629,14 +629,14 @@ pub fn remember(set: *Places, p: *Pardes, pane: *Pane) void {
}
/// The body as `remember` kept it: its selections and its view.
-pub fn restore(set: *Places, pane: *Pane) void {
+pub fn restore(set: *Places, tab: u16, pane: *Pane) void {
const f = if (pane.file) |*file| file else return;
if (set.snap.len == 0) return;
for (set.snap) |*r| {
r.anchor = @min(r.anchor, f.content.len);
r.head = @min(r.head, f.content.len);
}
- pane.body.setRanges(f.content, set.snap, &.{}, set.snap_pri, set.snap_expl);
+ pane.body.setRanges(tab, f.content, set.snap, &.{}, set.snap_pri, set.snap_expl);
f.scroll = set.snap_scroll;
f.syntax_dirty = true;
pane.hscroll = set.snap_hscroll;
@@ -672,7 +672,7 @@ pub fn paint(set: *Places, p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect,
var last_line: i32 = -1;
var vr: i32 = 0;
while (vr < body_h) : (vr += 1) {
- const line = pane.wrapAt(vr).line;
+ const line = pane.wrapAt(p.settings.tab, vr).line;
if (line == last_line or line < 0) continue;
if (line >= nlines) break;
last_line = line;