diff options
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 |
