summaryrefslogtreecommitdiff
path: root/core/Text.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 01:43:24 -0300
committerGabriel Schneider <[email protected]>2026-11-24 01:43:40 -0300
commited05c825102ebce7cd1e314226a1c88b8658baef (patch)
tree41957f9fb7c5df11389d7872079c6494f47af5ce /core/Text.zig
parent0252c830daf6184a9faefa32a7d1f384f5a86b94 (diff)
parent59b6ac1bae9cb6720252e1c3e1cc9d4f3a8ab3b1 (diff)
downloadpardes-ed05c825102ebce7cd1e314226a1c88b8658baef.tar.gz
pardes-ed05c825102ebce7cd1e314226a1c88b8658baef.zip
integration: the tree to install next: a view scrolls by ROWS: `main` (pardes-merge66, 0252c830daf6, installed 2026-11-24 01:22) and pardes-row-scroll-3 (`wkxsvmun` on `kyntorlp`, `rymstysv`, `qwssppvo`, on pardes-merge65: a view's top is (line, row within the line's own wrapped rows): a notch is one row through a wrapped line and a wrapped description of the layer, the margin, PageDown/PageUp, `gt`/`gb`, `gw`, `blankRows` and a Look's centring count rows; the wire 35); no conflict; REMOVED HERE: `core/walk.zig.orig`, a patch's leftover that `pvwuwnlk` had added; EXPECTED in its gate and ruled: corpus frame 76 differs (the margin counts rows: the new picture stands) and ten perf counts over tree7 (P85: the view now draws the rows the cursor is on in a wrapped line: deep-sel; the cursor's row found in long lines); its gate: .scratch/sketch/reorg/merge67, the numbers in PARDES.md
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Text.zig')
-rw-r--r--core/Text.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/Text.zig b/core/Text.zig
index 54d69a74..ba544bff 100644
--- a/core/Text.zig
+++ b/core/Text.zig
@@ -339,10 +339,19 @@ pub fn scrollViewMove(t: *Text, tab: u16, text: []const u8, range: modal.Selecti
if (t.what != .body) return;
const w = t.pane() orelse return;
const margin: i32 = @min(config.scroll_off, @divTrunc(@as(i32, w.rows) - 1, 2));
- w.scrollBy(delta);
+ w.scrollBy(tab, delta);
const top = w.scroll();
const last_row: i32 = @intCast(File.textLineCount(t, text) - 1);
const cur = modal.selectionCursor(text, range);
+ // A file's rows are not its lines: a line's first row at the margin,
+ // none (inside a line taller than the body) leaving the cursor be.
+ if (w.file != null) {
+ const snap = File.textRowLine(tab, w, if (delta > 0) margin else File.shownRows(tab, w) - 1 - margin, margin, if (delta > 0) .down else .up) orelse return;
+ const head = File.textLineStart(t, text, @intCast(snap));
+ if (if (delta > 0) head <= cur else head >= cur) return;
+ const anchor = if (t.select) range.anchor else head;
+ return setRange(t, tab, text, 0, .{ .anchor = anchor, .head = head }, false);
+ }
if (delta > 0) {
const snap: i32 = @max(0, @min(top + margin, last_row));
const head = File.textLineStart(t, text, @intCast(snap));