From 82551f77833a09b313bd3e58371582abd1aedcc4 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 27 Sep 2026 22:27:42 -0300 Subject: 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 --- src/pdf_view.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/pdf_view.zig') diff --git a/src/pdf_view.zig b/src/pdf_view.zig index 106252a0..9b623183 100644 --- a/src/pdf_view.zig +++ b/src/pdf_view.zig @@ -1962,7 +1962,7 @@ fn refreshCleanSections(core: *pardes.Pardes, state: *State) void { core.gpa.free(content); return; } - core.invalidateLookHover(remembered.pane); + look.invalidateLookHover(core, remembered.pane); File.setContent(core, file, content); const rows = File.lineCount(file.content); file.scroll = @min(file.scroll, rows - 1); @@ -2009,7 +2009,7 @@ fn rearmCleanSections( result.nsel = 0; pane.search_pane = remembered.pane; pane.search_row = null; - core.armLookWalk(remembered.pane); + look.armLookWalk(core, remembered.pane); core.active = id; return true; } @@ -2049,7 +2049,7 @@ pub fn openSections(core: *pardes.Pardes, id: usize) void { core.active = id; pane.search_pane = free; pane.search_row = null; - core.armLookWalk(free); + look.armLookWalk(core, free); } const SectionsOwner = struct { @@ -2098,7 +2098,7 @@ pub fn lookSection( const destination = owner.state.sectionDestination(core.pdf_gpa, at.col - 1) orelse return true; switch (destination) { .internal => |internal| { - core.clearNavigationSelection(owner.pane); + look.clearNavigationSelection(core, owner.pane); revealOutlineDestination(core, owner.pane, internal); }, .external => |uri| if (uri.len <= 256) core.emit(.{ .open_link = .from(uri) }), @@ -2282,7 +2282,7 @@ pub fn probeAt( const state = &(pane.pdf orelse return null); if (state.document.linkAt(core.pdf_gpa, page, point) catch null) |found| { var link = found; - if (core.pdfLinkLocation(pane, link) != null) { + if (look.pdfLinkLocation(core, pane, link) != null) { const quads = core.pdf_gpa.alloc(pdf.Quad, 1) catch { link.deinit(core.pdf_gpa); return null; -- cgit v1.3