summaryrefslogtreecommitdiff
path: root/core/look.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 03:04:50 -0300
committerGabriel Schneider <[email protected]>2026-11-19 03:28:58 -0300
commit5df97028a994b7e8c1720fd2dd2c1d8d943a8300 (patch)
treeb84f636d75fb9ac35dc0d595f8fe10426093e79a /core/look.zig
parent9cef1513bd4a9b0377b18f35b97aae141f9eb4e6 (diff)
downloadpardes-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/look.zig')
-rw-r--r--core/look.zig19
1 files changed, 12 insertions, 7 deletions
diff --git a/core/look.zig b/core/look.zig
index 6ff1da66..7ca8914f 100644
--- a/core/look.zig
+++ b/core/look.zig
@@ -335,7 +335,7 @@ fn lookFirstHit(p: *Pardes, id: usize) void {
const rp = p.panes[rid] orelse return;
if ((rp.file orelse return).content.len == 0) return;
p.view().active = rid;
- lookWalk(p, 1);
+ lookWalk(p, 1, true);
if (p.view().active != rid) return; // walked out of the list; leave it there
const txt = edit.currentSelText(p, rp) orelse return;
// spent, exactly as the look chord spends it (handleKey)
@@ -546,7 +546,7 @@ pub fn wordSpan(p: ?*pardes.Pardes, word: []const u8, cwd: []const u8, realbuf:
return .{ .start = 0, .end = word.len };
}
-fn lookSpanIn(p: *Pardes, pane: *Pane, from: LookFrom, delta: i32, budget: *usize) ?Pane.LookSpot {
+fn lookSpanIn(p: *Pardes, pane: *Pane, from: LookFrom, delta: i32, budget: *usize, disk: bool) ?Pane.LookSpot {
const lines = edit.paneCursorLines(p.editor(), &pane.body) catch return null;
const nrows: i32 = @intCast(lines.len);
if (nrows == 0) return null;
@@ -562,7 +562,8 @@ fn lookSpanIn(p: *Pardes, pane: *Pane, from: LookFrom, delta: i32, budget: *usiz
if (pane.file) |*f| if (!panes.Output.isWalkRow(f, @intCast(r), ln)) continue;
const on_start = r == start;
switch (grain) {
- .word => {
+ // Which words name a file is the disk's to say.
+ .word => if (disk) {
var best: ?Pane.LookSpot = null;
var i: usize = 0;
while (i < ln.len) {
@@ -577,7 +578,7 @@ fn lookSpanIn(p: *Pardes, pane: *Pane, from: LookFrom, delta: i32, budget: *usiz
if (delta > 0) break; // first one forward; keep the last one back
}
if (best) |b| return b;
- },
+ } else return null,
// one span per row, so there is nothing to keep and nothing to
// scan past: the row either offers it or it does not
.line, .whole => {
@@ -593,7 +594,7 @@ fn lookSpanIn(p: *Pardes, pane: *Pane, from: LookFrom, delta: i32, budget: *usiz
break :span @as(?Span, .{ .start = start_byte, .end = end });
}
};
- break :span lineSpan(p, ln, dir, &realbuf);
+ break :span if (disk) lineSpan(p, ln, dir, &realbuf) else null;
} orelse continue;
const col0: i32 = @intCast(sp.start);
if (lookPast(col0, from, on_start, delta))
@@ -610,7 +611,11 @@ fn commandPaneActive(p: *Pardes) bool {
return pane.command != null and pane.file == null and p.view().header == null;
}
-pub fn lookWalk(p: *Pardes, delta: i32) void {
+/// `disk`: a word or a row with no place of its own is look-able when it
+/// names a file, which the disk says (LookNext, a Look's walk, may wait);
+/// without, only the places the rows hold are (`n` in a kind's pane, a
+/// motion: what it reads is the core's).
+pub fn lookWalk(p: *Pardes, delta: i32, disk: bool) void {
var buf: [MAX_PANES]usize = undefined;
const order = lookWalkPanes(p, &buf);
if (order.len == 0) return;
@@ -628,7 +633,7 @@ pub fn lookWalk(p: *Pardes, delta: i32) void {
// `+ 2 * len` only so the backward subtraction stays unsigned
const idx = (if (delta > 0) at + k else at + 2 * order.len - k) % order.len;
const pane = p.panes[order[idx]] orelse continue;
- if (lookSpanIn(p, pane, from, delta, &budget)) |spot|
+ if (lookSpanIn(p, pane, from, delta, &budget, disk)) |spot|
return landLookSpot(p, order[idx], pane, spot);
if (budget == 0) return; // gave up mid-pane: stay put, stay reversible
from = lookEdge(delta);