diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 03:04:50 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 03:28:58 -0300 |
| commit | 5df97028a994b7e8c1720fd2dd2c1d8d943a8300 (patch) | |
| tree | b84f636d75fb9ac35dc0d595f8fe10426093e79a /core/replica.zig | |
| parent | 9cef1513bd4a9b0377b18f35b97aae141f9eb4e6 (diff) | |
| download | pardes-5df97028a994b7e8c1720fd2dd2c1d8d943a8300.tar.gz pardes-5df97028a994b7e8c1720fd2dd2c1d8d943a8300.zip | |
look: n and N in a kind's pane are a motion that reads no disk (the reorganisation's 12a; the user's ruling P14: motions instant on a far client): they walked Look's candidates across every result and output pane, and a word or a row with no place of its own was look-able only if the disk said it named a file (look.wordSpan and lineSpan through look.resolve to fs.resolve's realpath: 33 of the soak's 43 `resolve` stops); lookWalk now takes `disk`, and the key in a kind's pane walks without it: only the places the rows already hold (a row's location, a command row's whole line), so it steps the kind's +Search, references, errors and the like at once and skips words that might name a file, while LookNext and LookPrev (words, a Look's walk, which may wait) and the walk to a kind's first hit keep asking the disk as before; a test at the end of core/replica.zig (a client's n in a plain kind's pane, a scratch whose words name files standing first in the walk, lands on the kind's +Search row at once, confirmed fast), shown failing on the change before (stopped 1); the semantics word did not move; tui core-test 831/973 (142 skipped), shell-test 1008/1011, pane-test 183/184, behaviour-test 275/275 and --replay 275/275, process-test 2 of 144 failed (lspcomplete, lspcompletemoved, the base's; headersweep and cmdexit flaked and passed again), replicas --clients 5 diverged 0 unequal 0 deltas wrong 0 quiet differ 0 at 30/80/207 ms, stopped 89/75/108 (the base 104/133/147), mispredicted 37/34/36 on a run whose inputs now differ from the base's (the probe's 2-seed run with every host entry classed each one, before and after: a join's view, a clock's millisecond, a file's second, never a host call's: reports/pardes-seam-a.md), gui unit-test 1606/1610 (its perf check's BaselineHarnessMismatch the base's), daemon.py plain, --far, --games, --window-clients pass; gate-w seam-a-3 against tree1: 77/77 frames byte-identical in Debug, perfab corpus2x +0.045%, perfops 97 counts within 0.1% (largest +0.0012%)
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.zig | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/core/replica.zig b/core/replica.zig index 5ce8454e..fd691e04 100644 --- a/core/replica.zig +++ b/core/replica.zig @@ -5192,3 +5192,57 @@ test "a client's own Zerox and Del of a file pane are instant: what Recent keeps try std.testing.expectEqual(@as(u32, 0), r.stats.mispredicted); try std.testing.expect(a.core.recent.get(path) != null); } + +/// A kind whose state is plain and that takes no keys: normal mode has +/// them in its pane. +const Still = struct { + const pa = pardes.Kind.c; + fn open(_: [*c]const u8, _: [*c]const u8, _: u64) callconv(.c) ?*anyopaque { + return pardes.Kind.api.alloc.?(4); + } + fn paint(_: ?*anyopaque, _: [*c]const pa.pa_window, _: [*c]pa.pa_paint) callconv(.c) void {} + const words = [_]pa.pa_word{std.mem.zeroInit(pa.pa_word, .{ .name = "Still", .opens = 1, .doc = "a pane that takes no keys" })}; + const ops = std.mem.zeroInit(pardes.Kind.Ops, .{ + .head = std.mem.zeroInit(pa.pa_head, .{ .size = @sizeOf(pa.pa_head), .abi = pardes.Kind.abi, .name = "still".* ++ @as([11]u8, @splat(0)), .version = 1, .exts = "", .flags = pa.PA_PLAIN, .words = &words, .nwords = 1 }), + .open = open, + .paint = paint, + }); +}; + +test "a client's n in a kind's pane is a motion: it steps to the next place a result row holds at once, asking the disk nothing of words that might name files" { + const gpa = std.testing.allocator; + const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" }, TestHost.host(), false); + defer a.deinit(); + var cwd: [std.Io.Dir.max_path_bytes]u8 = undefined; + const dir = std.mem.span(@as([*:0]u8, @ptrCast(std.c.getcwd(&cwd, cwd.len) orelse return error.NoCwd))); + var words: [64]pardes.Kind.LoadedWord = undefined; + const still = pardes.Kind.loadedOf(&Still.ops, "/x/still.so", @splat(7), &words); + _ = try a.local(.{ .addon = .{ .op = .load, .pane = 0, .kind = &still } }); + // The kind's pane, its +Search (a place a row, as a kind's `/` leaves + // it), and a scratch whose words name files in the session's directory + // (as a command's output would). + _ = try a.local(.{ .command = "Still" }); + const kid = a.core.view().active; + try pardes.panes.Output.fillResults(a.core, kid, dir, .search, "first", try a.core.gpa.dupe(u8, "build.zig:1:1 first\n"), null); + const rid = a.core.panes[kid].?.search_pane.?; + _ = try a.local(.{ .command = "New" }); + for ("ibuild.zig mise.toml") |ch| _ = try a.local(.{ .key = .{ .cp = ch, .text = &[1]u8{ch} } }); + _ = try a.local(.{ .key = .{ .cp = pardes.Key.escape } }); + // The walk last stood in the scratch, at its start: its words first. + const scratch = a.core.panes[a.core.view().active].?; + scratch.body.cur_row = 0; + scratch.body.cur_col = 0; + a.core.look_walk_owner = scratch.serial; + a.core.view().active = kid; + const r = try joinedFresh(a); + defer r.deinit(); + r.core().kinds.ops[r.core().kinds.byName("still").?] = &Still.ops; + const msg = try gpa.dupe(u8, try r.input(.{ .key = .{ .cp = 'n', .text = "n" } })); + defer gpa.free(msg); + try std.testing.expectEqual(@as(u32, 0), r.stats.stopped); + try std.testing.expectEqual(rid, r.core().view().active); + r.confirm(try a.take(msg)); + r.settle(); + try std.testing.expectEqual(@as(u32, 1), r.stats.fast); + try agrees(a, r); +} |
