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 /src/builtins.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 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 074d1328..21dd4fa9 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1,6 +1,7 @@ //! Command structs and runtime settings form the builtin registry; bindings live in config.zig. const std = @import("std"); const pardes = @import("pardes.zig"); +const look = @import("look.zig"); const edit = @import("edit.zig"); const colors = @import("colors.zig"); const Pardes = pardes.Pardes; @@ -213,7 +214,7 @@ pub const Look = struct { // name on the message row would only be noise over that pub const quiet = true; pub fn run(c: Ctx) void { - c.p.lookAt(c.id, c.arg orelse return); + look.lookAt(c.p, c.id, c.arg orelse return); } }; @@ -711,7 +712,7 @@ pub const Find = struct { pub const output: OutputTraits = .{ .name = config.search_buffer, .steps = true }; pub fn run(c: Ctx) void { const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); - if (pat.len > 0) return c.p.runSearch(c.id, pat, .find, .top) catch |err| + if (pat.len > 0) return look.runSearch(c.p, c.id, pat, .find, .top) catch |err| c.p.reportError(c.id, "find", err); c.p.startPrompt(c.pane, .{ .search = config.find_marker }); } @@ -724,7 +725,7 @@ pub const Grep = struct { pub const output: OutputTraits = .{ .name = config.search_buffer, .steps = true, .locations = true }; pub fn run(c: Ctx) void { const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); - if (pat.len > 0) return c.p.runSearch(c.id, pat, .grep, .top) catch |err| + if (pat.len > 0) return look.runSearch(c.p, c.id, pat, .grep, .top) catch |err| c.p.reportError(c.id, "grep", err); c.p.startPrompt(c.pane, .{ .search = config.grep_marker }); } @@ -779,11 +780,11 @@ pub const Last = struct { i -= 1; const j = c.p.jumps[i]; // Restore the cursor without recentering the pane's retained view. - if (j.pane != c.id) return c.p.focusPaneLine(j.pane, .{ .line = j.line, .col = j.col }, .keep); + if (j.pane != c.id) return look.focusPaneLine(c.p, j.pane, .{ .line = j.line, .col = j.col }, .keep); } // Nothing on the jumplist to go back to, which is the ordinary case // for a pane that opened beside this one and was never focused. - if (c.p.neighbourPane(c.id)) |next| c.p.focusPaneLine(next, .{ .line = 0, .col = 0 }, .keep); + if (c.p.neighbourPane(c.id)) |next| look.focusPaneLine(c.p, next, .{ .line = 0, .col = 0 }, .keep); } }; |
