diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-07 01:02:25 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-07 01:42:27 -0300 |
| commit | 6decf23fe8ac1ce6b48dac42a3502900f6e251b7 (patch) | |
| tree | 5bdad28b45ca43f6494f34057e3211443ec26f50 /src/panes.zig | |
| parent | f316b46caea6ecf947989114c37af8288b37dbf5 (diff) | |
| download | pardes-6decf23fe8ac1ce6b48dac42a3502900f6e251b7.tar.gz pardes-6decf23fe8ac1ce6b48dac42a3502900f6e251b7.zip | |
follow: `Follow` (SPC c f) is Emacs's follow-mode, one text across a chain of Zerox twins shown in column order as consecutive pages (File.followChain, which syncTwins runs only for a twin group holding a chain): a scroll of any page reflows the others from it, the keyboard's page leaves its inner edges to the cursor, which goes on into the next page rather than scrolling it, the chain's ends scroll it as one pane, `Unfollow` on a follower's tag (or Del) takes a pane out, and the chain is a twin's `follow` flag with each view's `follow_scroll`, so a dump, Restore and replicas carry it; test/behaviour/follow.zig and follow.snap pin it, the reference, guide, changelog and builtins-json say it, and the builtins, leader and ttyhelp goldens list SPC c f
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/panes.zig')
| -rw-r--r-- | src/panes.zig | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/panes.zig b/src/panes.zig index a90613d0..6b6f621a 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -260,6 +260,13 @@ pub const Pane = struct { tag_lead: usize = 0, cwd: Cwd = .none, hscroll: i32 = 0, + /// A Follow chain's page (File.followChain): the scroll the chain last + /// gave it, each view's; on the keyboard's page, whether a page comes + /// before (1) and after (2), whose edge the cursor crosses rather than + /// scrolling, and whether it crossed one this step. + follow_scroll: usize = 0, + follow_edges: u2 = 0, + follow_crossed: bool = false, // Visible rows map to source lines and raw/display column origins. wrap_line: [limits.wrap_rows]i32 = undefined, wrap_col: [limits.wrap_rows]i32 = undefined, @@ -624,9 +631,10 @@ pub const Pane = struct { margin = @min(margin, @divTrunc(@max(0, lines_shown), 2)); } if (!in_context) { + if (pane.follow_edges != 0 and (pane.body.cur_row < off or pane.body.cur_row > last)) pane.follow_crossed = true; if (pane.body.cur_row < off + margin) { - pane.scrollBy(pane.body.cur_row - margin - off); - } else if (pane.body.cur_row > last - margin) { + if (pane.follow_edges & 1 == 0) pane.scrollBy(pane.body.cur_row - margin - off); + } else if (pane.body.cur_row > last - margin and pane.follow_edges & 2 == 0) { var to = pane.body.cur_row + margin; if (pane.file) |*f| { // The margin only reveals text: a pane its whole text |
