From 4c3dbce20f11204f6d4bfb715239beae74259e7f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 20:41:32 -0300 Subject: fields #38, the jump list, the language servers' question and the core's clock are fields of their nouns: Jump.zig is the jump list's type (list, n, cur, force, its own len annotation) and the session's jumps a Jump where it was jumps, njumps, jcur and jump_force; lsp/Ask.zig is the question's (seq, last, wait) and the session's lsp_ask an Ask where it was lsp_seq, lsp_last and lsp_wait; the clock is the session's clock, a Clock (now_ns, stepped_ns, started) where it was now_ns, stepped_ns and clock_started; a view opened still starts with no query's mark on its jumps and one closed leaves the staying view's (views.zig), as when the mark was a field of its own; callers in 26 files read p.jumps.n, p.lsp_ask.wait, p.clock.now_ns (macos.zig's lsp_wait tests by text, built nowhere here; dump.zig, the persistence agent's, only where it names lsp_seq); a dump written before this change loads these as their defaults once: an Upgrade or Restore from it comes back with no jumps, no language question awaited and its clock unstarted (jumps' kind changed, so the decoder says so), and the wire's semantics change; gates on tui: core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), snap all 108 scripts ok; gui unit-test 1518/1519 (1 skipped) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/pdf.zig | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test/pdf.zig') diff --git a/test/pdf.zig b/test/pdf.zig index bf0bfae7..2f14fb2f 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -1760,7 +1760,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { const query_before = try gpa.dupe(u8, pv.search_query); defer gpa.free(query_before); const search_hit_before = pv.search_hit; - const jumps_before = .{ p.njumps, p.jcur, p.n_look_src }; + const jumps_before = .{ p.jumps.n, p.jumps.cur, p.n_look_src }; const effects_before = p.effects_len; try std.testing.expect(p.drag == .none); @@ -1812,7 +1812,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { try std.testing.expect(std.meta.eql(selection_head_before, pv.selection_head)); try std.testing.expectEqualStrings(query_before, pv.search_query); try std.testing.expectEqual(search_hit_before, pv.search_hit); - try std.testing.expectEqual(jumps_before, .{ p.njumps, p.jcur, p.n_look_src }); + try std.testing.expectEqual(jumps_before, .{ p.jumps.n, p.jumps.cur, p.n_look_src }); try std.testing.expectEqual(effects_before, p.effects_len); try std.testing.expect(p.drag == .none); } @@ -2032,15 +2032,15 @@ test "PDF Back and Forward clear selections and land on recorded pages" { const state = pane.pdf.?; try std.testing.expect(state.page_count > 1); try std.testing.expect(state.focusLocation(p.pdf_gpa, 2, 0)); - p.njumps = 2; - p.jcur = 1; - p.jumps[0] = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 0 }; - p.jumps[1] = .{ .pane = 0, .serial = pane.serial, .line = 2, .col = 0 }; + p.jumps.n = 2; + p.jumps.cur = 1; + p.jumps.list[0] = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 0 }; + p.jumps.list[1] = .{ .pane = 0, .serial = pane.serial, .line = 2, .col = 0 }; for ([_]u21{ 'o', 'i' }, 0..) |key, destination| { try std.testing.expectEqual(panes.Pdf.SelectionUpdate.changed, state.setSelection(p.pdf_gpa, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 1 }, true)); try std.testing.expect(state.selection != null and state.selection_text.len > 0); p.update(.{ .key = .{ .cp = key, .ctrl = true } }); - try std.testing.expectEqual(destination, p.jcur); + try std.testing.expectEqual(destination, p.jumps.cur); try std.testing.expectEqual(destination, state.page); try std.testing.expect(state.selection == null); try std.testing.expect(state.selection_page == null); @@ -2111,11 +2111,11 @@ test "a PDF's jumps: Back after a far jump returns to the exact offset, two plac try jumpFrame(p); try std.testing.expect(pv.page_count > 3); // Two places on page 1, more than a body apart: two entries. - const before = p.njumps; + const before = p.jumps.n; _ = try stripAtPlace(p, pane, 1, 0.05); const near = try stripAtPlace(p, pane, 1, 0.8); - try std.testing.expectEqual(before + 2, p.njumps); - try std.testing.expect(p.jumps[p.njumps - 1].pdf); + try std.testing.expectEqual(before + 2, p.jumps.n); + try std.testing.expect(p.jumps.list[p.jumps.n - 1].pdf); // A far jump (a Look at a page), then Back: the exact offset, not the // page's top, and its page. look.lookAt(p, id, if (pv.page_count > 3000) ":3000" else ":4"); @@ -2126,12 +2126,12 @@ test "a PDF's jumps: Back after a far jump returns to the exact offset, two plac try std.testing.expectEqual(@as(usize, 1), pv.page); try std.testing.expectApproxEqAbs(near, pv.document_scroll_y, 0.5); // A wheel's small steps are the same visit: the entry follows them. - const n = p.njumps; + const n = p.jumps.n; for (0..4) |_| { _ = panes.Pdf.scrollPane(p, pane, 30, true); try jumpFrame(p); } - try std.testing.expectEqual(n, p.njumps); + try std.testing.expectEqual(n, p.jumps.n); } test "a PDF's jumps: JumpScope file keeps to the PDF, and a closed PDF reopens at its place" { @@ -2167,7 +2167,7 @@ test "a PDF's jumps: JumpScope file keeps to the PDF, and a closed PDF reopens a try p.removePane(doc, null); try jumpFrame(p); var closed = false; - for (p.jumps[0..p.njumps]) |j| closed = closed or (j.serial == 0 and j.pdf); + for (p.jumps.list[0..p.jumps.n]) |j| closed = closed or (j.serial == 0 and j.pdf); try std.testing.expect(closed); var tries: usize = 0; while (tries < 4) : (tries += 1) { -- cgit v1.3