From d1d5d3cfb18841604bba2057eeb3598f729b4475 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 02:56:53 -0300 Subject: client #1, the views indexed: a view's share of the session is Pardes.View (the ~42 fields views.fields named: size, cell metrics, columns, rects, focus, jumps, pointer, gestures, prefixes, frontend), one of Pardes.views[4] (null when closed), the live one views[live] through Pardes.view() (index field `view` renamed `live`); going into another view is the index plus the panes' shares, which stay swapped (park and unpark now move only Pane.pv); views.zig loses fields, Part over Pardes, Parked, kept, emptied and the session half of every copy, and a pane closing leaves every view's layout at once (views.gone, at the two places a slot is freed) instead of the serials each parked view kept; drawOne and within put the drawn view's own share back whole; the views are in the digest now (tape's per-field parts name views[k].field), so a fresh view's col_x/col_w default to zeros, not undefined; the dump keeps every open view in the core and the panes' shares of the others under `shares`; an image from before (live view as the core's own fields, the rest under `views`) loads them into views[] once; the ~2,400 references rewritten mechanically from the compiler's errors (p.active is p.view().active, `const v = p.view()` hoisted in 823 places), Kind.zig (4 lines) and addon_test.zig (3) among them, macos.zig by pattern (not compiled here); tape's watched host writes read the live view's frontend and active; perf.zig's accessor lines change its harness hash, the debug baselines re-keyed to it (their numbers the base's); no golden changes; gates: core-test 956/956 both, unit-test 1487/1488 tui and 1530/1531 gui, behaviour-test 248/248 both, pane-test 171/172, snap all 105 ok, process-test 0 of 37 failed tui, replicas ok Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Query.zig | 143 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 72 insertions(+), 71 deletions(-) (limited to 'src/Query.zig') diff --git a/src/Query.zig b/src/Query.zig index 749a5245..0f08ce80 100644 --- a/src/Query.zig +++ b/src/Query.zig @@ -265,7 +265,7 @@ pub fn open(p: *Pardes, from: usize, source: Source, arg: []const u8, focus: boo produce(p, id, false, false); // What a 9P exec reads back: the pane it filled (ninep/ctl.zig). p.fs.refilled = p.panes[id].?.serial; - if (focus) toLineOne(p, id) else p.active = from; + if (focus) toLineOne(p, id) else p.view().active = from; } /// The body rows a query pane is born with under its line 1 (and its @@ -303,7 +303,7 @@ fn create(p: *Pardes, owner_id: usize, line: []const u8, source: Source) ?usize var preview_rows: u16 = tag + born_rows; if (with_preview) { layout.compute(p); - const spare = p.rects[owner_id].h -| layout.minRows(p, owner_id); + const spare = p.view().rects[owner_id].h -| layout.minRows(p, owner_id); if (spare < want + preview_rows) { const both = want + preview_rows; want = @max(tag + 2, @as(u16, @intCast(@as(u32, spare) * want / both))); @@ -323,7 +323,7 @@ fn create(p: *Pardes, owner_id: usize, line: []const u8, source: Source) ?usize pub fn toLineOne(p: *Pardes, id: usize) void { const rp = p.panes[id] orelse return; tagline.exitHeader(p); - p.active = id; + p.view().active = id; if (layout.findPane(p, id)) |at| p.setActiveColumn(at.col); rp.focus = .body; const t = &rp.body; @@ -441,7 +441,7 @@ fn produce(p: *Pardes, id: usize, tick: bool, keyed: bool) void { if (a.pat.len == 0) { if (set.from == rp.serial) set.clear(p.gpa); set.restore(owner); - } else set.search(p, owner, .typed, rp.serial, a.pat, false, set.origin(owner), p.active == id); + } else set.search(p, owner, .typed, rp.serial, a.pat, false, set.origin(owner), p.view().active == id); } // The owner edited: its places shifted at once; the rows follow // once its text has stood a frame. @@ -518,7 +518,7 @@ fn produce(p: *Pardes, id: usize, tick: bool, keyed: bool) void { // Typed, not answered: asked of the language server at the // owner's cursor; its answer fills these rows (fillList). // An answer opening the pane is no typing. - if (p.active != id) return; + if (p.view().active != id) return; if (owner_id) |oid| p.lspRequest(oid, switch (a.source) { .refs => .references, .defs => .definition, @@ -1302,11 +1302,11 @@ pub fn fillList(p: *Pardes, owner_id: usize, source: Source, rows: []const u8) v // on the current row in normal mode (j, k, n, N step, Enter lands, Esc // goes back), line 1 left as text for whoever wants to edit it. if (source == .diagnostics) { - p.active = owner_id; + p.view().active = owner_id; return; } tagline.exitHeader(p); - p.active = qid; + p.view().active = qid; if (layout.findPane(p, qid)) |at| p.setActiveColumn(at.col); rp.focus = .body; const t = &rp.body; @@ -1523,9 +1523,9 @@ pub fn step(p: *Pardes, id: usize, delta: i32) void { if (q.source == .text) if (p.paneBySerial(q.owner)) |oid| { const owner = p.panes[oid].?; if (owner.places.from == rp.serial) { - const keyboard = p.active; + const keyboard = p.view().active; owner.places.step(p, owner, delta > 0, 1, false); - p.active = keyboard; + p.view().active = keyboard; showPlacesCurrent(p, id); return; } @@ -1584,8 +1584,8 @@ fn showTarget(p: *Pardes, id: usize) void { if (c + 1 >= f.location_rows.len) return; const it = q.items.items[c]; const meta = f.location_rows[c + 1]; - const keyboard = p.active; - defer p.active = keyboard; + const keyboard = p.view().active; + defer p.view().active = keyboard; if (it.serial != 0) { const tid = p.paneBySerial(it.serial) orelse return; const tp = p.panes[tid].?; @@ -1676,7 +1676,7 @@ fn makePreview(p: *Pardes, qid: usize, rows: u16, giver: usize) ?usize { /// file open in a pane would be shown there instead), the place centred /// and selected. Made when the pane has none and its owner has the rows. fn displayPreview(p: *Pardes, qid: usize, path: []const u8, at: look.Spot) void { - const id = previewOf(p, qid) orelse makePreview(p, qid, p.rects[qid].h / 2, qid) orelse return; + const id = previewOf(p, qid) orelse makePreview(p, qid, p.view().rects[qid].h / 2, qid) orelse return; const pane = p.panes[id].?; const f = &pane.file.?; if (!std.mem.eql(u8, f.path, path)) { @@ -1778,6 +1778,7 @@ fn promote(p: *Pardes, qid: usize, id: usize) void { /// in its pane (the +Preview promoted to the file's pane when it shows /// it), a `/` into the register, and the rows frozen into ordinary text. pub fn land(p: *Pardes, id: usize, row: ?usize) void { + const v = p.view(); const rp = p.panes[id] orelse return; const q = rp.query orelse return; if (row) |r| if (r < q.items.items.len and q.items.items[r].kind == .hit) setCurrent(p, id, r, true); @@ -1803,8 +1804,8 @@ pub fn land(p: *Pardes, id: usize, row: ?usize) void { p.registers.last_search = '/'; set.provenance = .search; } - p.jumps.force = true; - p.active = oid; + v.jumps.force = true; + v.active = oid; return; } const f = &rp.file.?; @@ -1813,15 +1814,15 @@ pub fn land(p: *Pardes, id: usize, row: ?usize) void { // is none: there is nowhere to land, as with no current one. const current = if (q.current) |i| (if (i < q.items.items.len and i + 1 < f.location_rows.len) i else null) else null; const c = current orelse { - if (owner_id) |oid| p.active = oid; + if (owner_id) |oid| v.active = oid; return; }; const it = q.items.items[c]; const meta = f.location_rows[c + 1]; - p.jumps.force = true; + v.jumps.force = true; if (it.serial != 0) { if (p.paneBySerial(it.serial)) |tid| { - p.active = tid; + v.active = tid; if (layout.findPane(p, tid)) |at| p.setActiveColumn(at.col); } return; @@ -1833,7 +1834,7 @@ pub fn land(p: *Pardes, id: usize, row: ?usize) void { }, .panes => { if (p.paneBySerial(it.ref)) |tid| { - p.active = tid; + v.active = tid; if (layout.findPane(p, tid)) |at| p.setActiveColumn(at.col); return; } @@ -1847,7 +1848,7 @@ pub fn land(p: *Pardes, id: usize, row: ?usize) void { // The preview shows it: promoted where it stands. if (previewOf(p, id)) |pid| if (std.mem.eql(u8, p.panes[pid].?.file.?.path, meta.path)) { promote(p, id, pid); - p.active = pid; + v.active = pid; if (q.source == .grep) { const a = parse(q.asked) orelse return; const pp = p.panes[pid].?; @@ -1923,14 +1924,14 @@ pub fn cancel(p: *Pardes, id: usize) void { const owner = p.panes[oid].?; owner.places.search(p, owner, .search, rp.serial, a.pat, false, null, false); }; - if (owner_id) |oid| p.active = oid; + if (owner_id) |oid| p.view().active = oid; return; } // Attached, its rows go back to its owner; else to its own column's. const attached = layout.ownerOf(p, id) != null; if (owner_id) |oid| { p.removePane(id, if (attached) oid else null) catch {}; - p.active = oid; + p.view().active = oid; if (layout.findPane(p, oid)) |at| p.setActiveColumn(at.col); } else p.removePane(id, null) catch {}; } @@ -2163,10 +2164,10 @@ test "a / query: keystroke by keystroke, the owner shows the set, rows from its defer p.deinit(); const pane = try p.setTestFile("alpha one\nbeta\nalphabet\ngamma alpha\nalpha two\ndelta\n"); p.newScratchBelow(0); - const below = p.cols[0].panes[1]; - p.active = 0; + const below = p.view().cols[0].panes[1]; + p.view().active = 0; layout.compute(p); - const before = p.rects; + const before = p.view().rects; // cursor on line 3 (row 2) pane.body.cur_row = 2; pane.body.cur_col = 0; @@ -2174,9 +2175,9 @@ test "a / query: keystroke by keystroke, the owner shows the set, rows from its const qid = queryPane(p).?; const qp = p.panes[qid].?; try std.testing.expectEqual(@as(?usize, 0), layout.ownerOf(p, qid)); - try std.testing.expectEqual(qid, p.active); - try std.testing.expectEqualDeep(before[below], p.rects[below]); - const born = p.rects[qid]; + try std.testing.expectEqual(qid, p.view().active); + try std.testing.expectEqualDeep(before[below], p.view().rects[below]); + const born = p.view().rects[qid]; try std.testing.expectEqualStrings("/", lineOne(qp.file.?.content)); // keystroke 1 typeKeys(p, "a"); @@ -2184,7 +2185,7 @@ test "a / query: keystroke by keystroke, the owner shows the set, rows from its try std.testing.expectEqual(Source.text, q.source); try std.testing.expect(pane.places.started and pane.places.from == qp.serial); try std.testing.expect(q.total > 0); - try std.testing.expectEqualDeep(born, p.rects[qid]); + try std.testing.expectEqualDeep(born, p.view().rects[qid]); // keystroke 2 .. `alph`: four places on four lines (rows), the // current the first at or after the cursor (line 3's alphabet) typeKeys(p, "lph"); @@ -2193,9 +2194,9 @@ test "a / query: keystroke by keystroke, the owner shows the set, rows from its try std.testing.expectEqual(@as(?usize, 1), pane.places.current); const sel = pane.body.primaryRange(pane.file.?.content, 0); try std.testing.expectEqual(@as(usize, 15), @min(sel.anchor, sel.head)); - try std.testing.expectEqualDeep(born, p.rects[qid]); - try std.testing.expectEqualDeep(before[below], p.rects[below]); - try std.testing.expectEqual(qid, p.active); + try std.testing.expectEqualDeep(born, p.view().rects[qid]); + try std.testing.expectEqualDeep(before[below], p.view().rects[below]); + try std.testing.expectEqual(qid, p.view().active); // Ctrl-n steps, the owner follows p.update(.{ .key = .{ .cp = 'n', .ctrl = true } }); try std.testing.expectEqual(@as(usize, 3), q.k); @@ -2209,16 +2210,16 @@ test "a / query: keystroke by keystroke, the owner shows the set, rows from its try std.testing.expectEqual(@as(usize, 0), q.total); try std.testing.expect(p.panes[qid] != null); try std.testing.expectEqualStrings("/alphzz", lineOne(qp.file.?.content)); - try std.testing.expectEqualDeep(born, p.rects[qid]); + try std.testing.expectEqualDeep(born, p.view().rects[qid]); const tag = try tagline.pathPrefix(p, p.scratch.allocator(), qp); try std.testing.expectEqualStrings("+Search 0", tag); // Esc: the pane gone, its rows back to the owner, the owner as it was p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expect(p.panes[qid] == null); - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); layout.compute(p); - try std.testing.expectEqualDeep(before[0], p.rects[0]); - try std.testing.expectEqualDeep(before[below], p.rects[below]); + try std.testing.expectEqualDeep(before[0], p.view().rects[0]); + try std.testing.expectEqualDeep(before[below], p.view().rects[below]); try std.testing.expect(!pane.places.started); try std.testing.expectEqual(@as(i32, 2), pane.body.cur_row); } @@ -2252,7 +2253,7 @@ test "a / query: Enter lands and freezes, the register filled, n and N step sile const q = qp.query.?; p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expect(q.frozen); - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); try std.testing.expectEqualStrings("alpha", p.registers.value('/', 0).?); try std.testing.expectEqual(Places.Provenance.search, pane.places.provenance); const frozen = try std.testing.allocator.dupe(u8, qp.file.?.content); @@ -2277,7 +2278,7 @@ test "a / query: Enter lands and freezes, the register filled, n and N step sile // a later `/` reuses the pane: line 1 fresh, the rows the new query's typeKeys(p, "/"); try std.testing.expectEqual(qid, queryPane(p).?); - try std.testing.expectEqual(qid, p.active); + try std.testing.expectEqual(qid, p.view().active); try std.testing.expect(!q.frozen); typeKeys(p, "beta"); try std.testing.expectEqual(@as(usize, 1), q.total); @@ -2328,11 +2329,11 @@ test "Find: names fuzzy per keystroke, the group born with its +Preview, nothing defer p.deinit(); _ = try testFileIn(p, &tmp, "x.txt", "x\n"); p.newScratchBelow(0); - const other = p.cols[0].panes[1]; + const other = p.view().cols[0].panes[1]; try std.testing.expect(layout.splitColumn(p, other, other, false)); - p.active = 0; + p.view().active = 0; layout.compute(p); - const before = p.rects; + const before = p.view().rects; leader(p, "ff"); const qid = queryPane(p).?; const q = p.panes[qid].?.query.?; @@ -2341,32 +2342,32 @@ test "Find: names fuzzy per keystroke, the group born with its +Preview, nothing // the group: owner, query pane, +Preview, out of the owner's rows alone const pv = previewOf(p, qid).?; try std.testing.expectEqual(@as(usize, 0), layout.groupRoot(p, pv)); - try std.testing.expectEqualDeep(before[other], p.rects[other]); - try std.testing.expectEqual(before[0].h, p.rects[0].h + p.rects[qid].h + p.rects[pv].h); + try std.testing.expectEqualDeep(before[other], p.view().rects[other]); + try std.testing.expectEqual(before[0].h, p.view().rects[0].h + p.view().rects[qid].h + p.view().rects[pv].h); settle(p); // an empty query lists every name try std.testing.expectEqual(@as(usize, 4), q.total); - const born = p.rects; + const born = p.view().rects; typeKeys(p, "lay"); settle(p); try std.testing.expectEqual(@as(usize, 1), q.total); - try std.testing.expectEqualDeep(born[qid], p.rects[qid]); - try std.testing.expectEqualDeep(born[pv], p.rects[pv]); + try std.testing.expectEqualDeep(born[qid], p.view().rects[qid]); + try std.testing.expectEqualDeep(born[pv], p.view().rects[pv]); // the current one in the preview, never by the pointer try std.testing.expect(std.mem.endsWith(u8, p.panes[pv].?.file.?.path, "src/layout.zig")); - try std.testing.expectEqual(qid, p.active); + try std.testing.expectEqual(qid, p.view().active); const serial = p.panes[pv].?.serial; - const rect = p.rects[pv]; + const rect = p.view().rects[pv]; p.update(.{ .key = .{ .cp = Key.enter } }); // promoted where it stands: same slot, serial, rect; a file pane now - try std.testing.expectEqual(pv, p.active); + try std.testing.expectEqual(pv, p.view().active); try std.testing.expectEqual(serial, p.panes[pv].?.serial); try std.testing.expect(p.panes[pv].?.file.?.output == null); try std.testing.expect(p.panes[pv].?.attached_to == null); layout.compute(p); - try std.testing.expectEqualDeep(rect, p.rects[pv]); + try std.testing.expectEqualDeep(rect, p.view().rects[pv]); try std.testing.expect(q.frozen); - try std.testing.expectEqualDeep(before[other], p.rects[other]); + try std.testing.expectEqualDeep(before[other], p.view().rects[other]); } test "Grep: lines of the files under the owner's directory, under their file; All: every pane's, under @pN in serial order, a line once" { @@ -2394,10 +2395,10 @@ test "Grep: lines of the files under the owner's directory, under their file; Al // All: a second pane, both searched, grouped by serial p.newScratchBelow(0); - const s = p.active; + const s = p.view().active; const sf = &p.panes[s].?.file.?; File.setContent(p, sf, try p.gpa.dupe(u8, "needle needle twice\n")); - p.active = 0; + p.view().active = 0; leader(p, "/"); const aid = queryPane(p).?; const aq = p.panes[aid].?.query.?; @@ -2424,15 +2425,15 @@ test "* seeds line 1 and keeps the keyboard; SPC b b picks a pane, SPC s s a dec // `*` on `const`: line 1 `/\bconst\b`, the keyboard still in the text typeKeys(p, "e*"); const qid = queryPane(p).?; - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); try std.testing.expect(std.mem.startsWith(u8, lineOne(p.panes[qid].?.file.?.content), "/")); try std.testing.expect(pane.places.started); typeKeys(p, "n"); try std.testing.expectEqual(@as(?usize, 0), pane.places.current); // SPC b b: the open panes by name; Enter goes to the marked one p.newScratchBelow(0); - const other = p.active; - p.active = 0; + const other = p.view().active; + p.view().active = 0; leader(p, "bb"); const bid = queryPane(p).?; try std.testing.expectEqual(bid, qid); @@ -2440,7 +2441,7 @@ test "* seeds line 1 and keeps the keyboard; SPC b b picks a pane, SPC s s a dec try std.testing.expect(p.panes[bid].?.query.?.total >= 1); // SPC s s: the declarations, fuzzy; Enter lands on the line p.update(.{ .key = .{ .cp = Key.escape } }); - p.active = 0; + p.view().active = 0; leader(p, "ss"); const sid = queryPane(p).?; try std.testing.expectEqual(Source.symbols, p.panes[sid].?.query.?.source); @@ -2448,7 +2449,7 @@ test "* seeds line 1 and keeps the keyboard; SPC b b picks a pane, SPC s s a dec typeKeys(p, "bet"); try std.testing.expectEqual(@as(usize, 1), p.panes[sid].?.query.?.total); p.update(.{ .key = .{ .cp = Key.enter } }); - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); _ = other; } @@ -2475,7 +2476,7 @@ test "a language server's list: one answer lands with no pane, several open the p.lspRequest(0, .references, ""); p.update(.{ .lsp_resp = .{ .id = p.lsp_ask.wait.?.id, .rows = "/test.txt:3:1-5 alpha two\n" } }); try std.testing.expectEqual(@as(usize, 1), npanes(p)); - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); try std.testing.expectEqual(@as(i32, 2), pane.body.cur_row); try std.testing.expectEqual(@as(usize, 1), pane.places.hits.items.len); try std.testing.expectEqual(Places.Hit{ .start = 15, .end = 20 }, pane.places.hits.items[0]); @@ -2493,7 +2494,7 @@ test "a language server's list: one answer lands with no pane, several open the const qid = queryPane(p).?; const qp = p.panes[qid].?; const q = qp.query.?; - try std.testing.expectEqual(qid, p.active); + try std.testing.expectEqual(qid, p.view().active); try std.testing.expect(qp.body.mode == .normal); try std.testing.expect(std.mem.startsWith(u8, qp.file.?.content, "Refs")); try std.testing.expectEqual(@as(i32, @intCast(q.current.? + 1)), qp.body.cur_row); @@ -2506,7 +2507,7 @@ test "a language server's list: one answer lands with no pane, several open the // Esc: back to the text, as it was, the list gone. p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expect(p.panes[qid] == null); - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); try std.testing.expectEqual(@as(i32, 0), pane.body.cur_row); } @@ -2523,7 +2524,7 @@ test "B1 on a query pane's rows places the caret and selects, nothing else, the const owner_scroll = pane.file.?.scroll; try std.testing.expectEqual(@as(?usize, 0), q.current); const place = pane.places.current; - const r = p.rects[qid]; + const r = p.view().rects[qid]; const row_y = r.y + qp.tag_rows; const y = row_y + 3; const x = r.x + config.GUTTER + File.gutterWidth(qp) + 6; @@ -2551,7 +2552,7 @@ test "B1 on a query pane's rows places the caret and selects, nothing else, the try std.testing.expectEqual(@as(?usize, 0), q.current); try std.testing.expectEqual(owner_sel, pane.body.primaryRange(pane.file.?.content, 0)); // the keyboard: n steps from the current row, not the caret's, the caret with it - p.active = qid; + p.view().active = qid; if (qp.body.mode == .insert) p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expect(p.panes[qid] != null); typeKeys(p, "n"); @@ -2564,9 +2565,9 @@ test "B1 on a query pane's rows places the caret and selects, nothing else, the // B1 elsewhere, then Enter: the current row lands, not the caret's p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = x, .row = row_y + 1 } }); p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = x, .row = row_y + 1 } }); - p.active = qid; + p.view().active = qid; p.update(.{ .key = .{ .cp = Key.enter } }); - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); try std.testing.expectEqual(@as(i32, 3), pane.body.cur_row); } @@ -2575,7 +2576,7 @@ test "Enter on a frozen query pane's rows after its text was edited: no row to l defer p.deinit(); _ = try p.setTestFile("alpha\n"); p.newScratchBelow(0); - p.active = 0; + p.view().active = 0; // SPC b b and Enter: the current row lands, the rows frozen. leader(p, "bb"); const qid = queryPane(p).?; @@ -2583,12 +2584,12 @@ test "Enter on a frozen query pane's rows after its text was edited: no row to l const qp = p.panes[qid].?; try std.testing.expect(qp.query.?.frozen and qp.query.?.current != null); // Its text edited: the rows' places go with the text they were of. - p.active = qid; + p.view().active = qid; typeKeys(p, "ggjxd"); try std.testing.expectEqual(@as(usize, 0), qp.file.?.location_rows.len); try std.testing.expect(qp.body.cur_row > 0); p.update(.{ .key = .{ .cp = Key.enter } }); - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); } test "a query row's place is its text: the match tinted after it, B3 on it opens the place, the rows saved and read again still Look" { @@ -2625,19 +2626,19 @@ test "a query row's place is its text: the match tinted after it, B3 on it opens // B3 on the address: the place, in the pane that shows it a.body.cur_row = 0; p.presented(); - const r = p.rects[qid]; + const r = p.view().rects[qid]; const y = r.y + qp.tag_rows + @as(u16, @intCast(row4)) - @as(u16, @intCast(qp.scroll())); const x = r.x + config.GUTTER + File.gutterWidth(qp) + 3; p.update(.{ .mouse = .{ .button = .right, .kind = .press, .col = x, .row = y } }); p.update(.{ .mouse = .{ .button = .right, .kind = .release, .col = x, .row = y } }); - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); try std.testing.expectEqual(@as(i32, 3), a.body.cur_row); // the rows as a plain text in that directory (what Save writes): a // Look at a row's address word still goes there const saved = try std.testing.allocator.dupe(u8, f.content); defer std.testing.allocator.free(saved); p.newScratchBelow(0); - const sid = p.active; + const sid = p.view().active; const sp = p.panes[sid].?; File.setContent(p, &sp.file.?, try p.gpa.dupe(u8, saved)); try std.testing.expect(sp.query == null and sp.file.?.location_rows.len == 0); @@ -2646,7 +2647,7 @@ test "a query row's place is its text: the match tinted after it, B3 on it opens const word = look.expandedWord(line, 3).?; a.body.cur_row = 0; look.lookAt(p, sid, line[word.lo..word.hi]); - try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(usize, 0), p.view().active); try std.testing.expectEqual(@as(i32, 1), a.body.cur_row); } -- cgit v1.3