diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 22:27:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 82551f77833a09b313bd3e58371582abd1aedcc4 (patch) | |
| tree | b2d0b53d1c2346bdbaefda8b3a5e965df377d26c /test/pdf.zig | |
| parent | 5be25178e4bfc2f390164e06697155cb0237babc (diff) | |
| download | pardes-82551f77833a09b313bd3e58371582abd1aedcc4.tar.gz pardes-82551f77833a09b313bd3e58371582abd1aedcc4.zip | |
Move looking out of pardes.zig into look.zig
Pure move, no behaviour change (acme keeps this in look.c): expanding the
word under a click (ExpandedWord, expandedWord, expandedSel, cursorWordSel),
the n/N walk (LookFrom, lookEdge, lookStand, lookWalkPanes, lookPast,
wholeRowSpan, lookSpanIn, lookWalk, landLookSpot, noteLookSource,
armLookWalk), search results (Search, SearchStart, submitSearch,
lookFirstHit, runSearch, searchStep, jumpResult), the look-hover preview
(LookHoverWait, LookHoverPreview, FileWordSpan, PdfWordPreview,
invalidateLookHover, cancelLookHover, lookHoverPane, noteLookHover,
refreshLookHoverFromRaw, advanceLookHover) and lookAt with its targets
(focusPaneLine, selectSpan, openPaneTarget, focusPaneByPath,
clearNavigationSelection, resolveLookTarget, locationText,
canonicalLookLocation, pdfLinkLocation, followPdfLink), with five tests, go
verbatim to the end of look.zig after its word and target resolution.
The methods become free functions taking `p: *Pardes`; their 143 call sites
change from `p.lookAt(..)` to `look.lookAt(p, ..)` (tests reach them as
`pardes.look.x`). Inside look.zig the moved code's `look.` prefix drops.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/pdf.zig')
| -rw-r--r-- | test/pdf.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/pdf.zig b/test/pdf.zig index 25d0de76..69a82123 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -135,9 +135,9 @@ const PdfLinkTests = struct { const choices_id = for (p.panes, 0..) |slot, id| { if (slot == choices) break id; } else return error.MissingPdfLinkChoices; - p.lookAt(choices_id, "https://example.com/embedded"); + pardes.look.lookAt(p, choices_id, "https://example.com/embedded"); try expectOpened(p, "https://example.com/embedded"); - p.lookAt(choices_id, "target.txt"); + pardes.look.lookAt(p, choices_id, "target.txt"); try std.testing.expectEqualStrings("chosen file\n", p.panes[p.active].?.file.?.content); p.active = 0; _ = try p.render(frame.allocator()); @@ -349,16 +349,16 @@ test "PdfSections Look follows the exact owning PDF, not an equal path" { const first_row = std.mem.sliceTo(first_output.file.?.content, '\n'); const target = first_row[0 .. std.mem.indexOfScalar(u8, first_row, ' ') orelse first_row.len]; - p.lookAt(first_output_id, target); + pardes.look.lookAt(p, first_output_id, target); try std.testing.expectEqual(@as(usize, 0), p.active); - p.lookAt(duplicate_output_id, target); + pardes.look.lookAt(p, duplicate_output_id, target); try std.testing.expectEqual(duplicate_id, p.active); // Once the original document is gone, its output cannot reinterpret an // old ordinal against the still-open equal-path duplicate. try std.testing.expect(pardes.test_api.runBuiltin(p, "Del", 0, "", null)); p.active = first_output_id; - p.lookAt(first_output_id, target); + pardes.look.lookAt(p, first_output_id, target); try std.testing.expectEqual(first_output_id, p.active); } @@ -881,7 +881,7 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" { try std.testing.expect(pane.pdf.?.document_scroll_y > before_height_scroll); const revision_before_search = active_raster.revision; - try p.runSearch(0, "Pardes", .text, .top); + try pardes.look.runSearch(p, 0, "Pardes", .text, .top); try std.testing.expectEqualStrings("Pardes", pane.pdf.?.search_query); try std.testing.expectEqual(revision_before_search, active_raster.revision); const results_id = pane.search_pane orelse return error.MissingPdfSearchResults; @@ -1578,7 +1578,7 @@ test "PDF n/N addresses and reveals distinct MuPDF hits on one page" { p.locations_config.context = 2; p.locations_config.tscontext = true; - try p.runSearch(0, "Pardes", .text, .top); + try pardes.look.runSearch(p, 0, "Pardes", .text, .top); const results_id = pane.search_pane orelse return error.MissingPdfSearchResults; const results = p.panes[results_id].?.file.?; var found: [3]bool = @splat(false); |
