diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-18 23:49:29 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 01:35:13 -0300 |
| commit | 1ca3e68f38385952fa5a2ccc3dac883ba0be71e8 (patch) | |
| tree | bffbbf9e5e5b2b929d79bd81ea805c5288896623 /core/locations.zig | |
| parent | e567aadc19f58b1e36098388483294321f3502dd (diff) | |
| download | pardes-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/locations.zig')
| -rw-r--r-- | core/locations.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/locations.zig b/core/locations.zig index da8179d0..6972647e 100644 --- a/core/locations.zig +++ b/core/locations.zig @@ -234,7 +234,7 @@ pub fn parseRows(arena: std.mem.Allocator, text: []const u8) error{ OutOfMemory, /// Compare native producer rows with an already formatted, context-free view. /// Identical refreshes retain allocations, syntax and selection state. -pub fn sameInput(input: []const u8, rendered: []const u8, rows: []const Row, layout: Config.Layout) bool { +pub fn sameInput(tab: u16, input: []const u8, rendered: []const u8, rows: []const Row, layout: Config.Layout) bool { if (rows.len == 0) return std.mem.eql(u8, input, rendered); var raw_lines = std.mem.splitScalar(u8, input, '\n'); var shown_lines = std.mem.splitScalar(u8, rendered, '\n'); @@ -249,7 +249,7 @@ pub fn sameInput(input: []const u8, rendered: []const u8, rows: []const Row, lay for (0..alignment_entries) |_| { const line = chunk.next() orelse break; const target = parseRaw(line); - width = @max(width, pardes.panes.File.displayWidth(line[0..target.end])); + width = @max(width, pardes.panes.File.displayWidth(tab, line[0..target.end])); } } const raw = raw_lines.next() orelse return false; @@ -272,7 +272,7 @@ pub fn sameInput(input: []const u8, rendered: []const u8, rows: []const Row, lay // let the identical-input shortcut retain that layout when rerun. if (row.code_start <= row.location_end) return false; const padding = shown[row.location_end..row.code_start]; - if (padding.len != width - pardes.panes.File.displayWidth(raw[0..target.end]) + 1 or + if (padding.len != width - pardes.panes.File.displayWidth(tab, raw[0..target.end]) + 1 or padding[padding.len - 1] != '\t') return false; for (padding[0 .. padding.len - 1]) |byte| if (byte != ' ') return false; index += 1; @@ -538,8 +538,8 @@ pub fn formatCallstack(p: *pardes.Pardes, dir: []const u8, input: []const u8) !R var guide_buf: [1024]u8 = undefined; const guide = treeContinuation(line, &guide_buf, std.math.maxInt(usize)); try out.writer.writeAll(guide); - const width = pardes.panes.File.displayWidth(line[0..prefix.end]); - try out.writer.splatByteAll(' ', width -| pardes.panes.File.displayWidth(guide)); + const width = pardes.panes.File.displayWidth(p.settings.tab, line[0..prefix.end]); + try out.writer.splatByteAll(' ', width -| pardes.panes.File.displayWidth(p.settings.tab, guide)); const code_start = out.written().len - start; const trim = @min(source_indent, code_line.len - std.mem.trimStart(u8, code_line, " \t").len); try out.writer.writeAll(code_line[trim..]); @@ -691,7 +691,7 @@ pub fn format(p: *pardes.Pardes, dir: []const u8, input: []const u8, anchor: ?us while (first < pending.items.len) { const end = alignmentEnd(pending.items, first); var width: usize = 0; - for (pending.items[first..end]) |row| width = @max(width, labelWidth(row)); + for (pending.items[first..end]) |row| width = @max(width, labelWidth(p.settings.tab, row)); for (pending.items[first..end], first..) |row, index| { const before = out.written().len; const context = row.original == null; @@ -701,7 +701,7 @@ pub fn format(p: *pardes.Pardes, dir: []const u8, input: []const u8, anchor: ?us try out.writer.writeByte(' '); try out.writer.splatByteAll('*', row.depth); } - try out.writer.splatByteAll(' ', width - labelWidth(row)); + try out.writer.splatByteAll(' ', width - labelWidth(p.settings.tab, row)); try out.writer.writeByte('\t'); const code_start = out.written().len - before; try writeCode(&out.writer, pending.items, index); @@ -757,8 +757,8 @@ fn alignmentEnd(rows: []const Pending, first: usize) usize { return rows.len; } -fn labelWidth(row: Pending) usize { - return pardes.panes.File.displayWidth(row.label) + +fn labelWidth(tab: u16, row: Pending) usize { + return pardes.panes.File.displayWidth(tab, row.label) + @as(usize, if (row.depth > 0) row.depth + 1 else 0); } |
