summaryrefslogtreecommitdiff
path: root/test/perf.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 /test/perf.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 'test/perf.zig')
-rw-r--r--test/perf.zig14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/perf.zig b/test/perf.zig
index 8622e31b..f36d64ac 100644
--- a/test/perf.zig
+++ b/test/perf.zig
@@ -631,7 +631,7 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u
for (0..warmup + reps) |n| {
if (op != .deep_selection) seek(pane, fx, n);
_ = try frame(core); // settle the view at the new spot, untimed
- const before = .{ .row = pane.body.cur_row, .col = pane.body.cur_col, .scroll = pane.scroll(), .len = pane.file.?.content.len };
+ const before = .{ .row = pane.body.cur_row, .col = pane.body.cur_col, .scroll = pane.scroll(), .scroll_row = pane.file.?.scroll_row, .len = pane.file.?.content.len };
const rect = core.view().rects[id];
const wheel_col = rect.x + pardes.config.GUTTER;
const wheel_row = rect.y + pardes.BOX_H;
@@ -658,9 +658,11 @@ fn measure(op: Op, fx: Fixture, path: []const u8, expected_bytes: usize, reps: u
return error.RenderChangedDocument,
.key_down => if (pane.body.cur_row != before.row + 1) return error.DownDidNotMove,
.key_right => if (pane.body.cur_row != before.row or pane.body.cur_col != before.col + 1) return error.RightDidNotMove,
- .page_down => if (pane.scroll() <= before.scroll and before.scroll < @as(i32, @intCast(fx.lines)) - pane.rows)
+ // A view moves by rows (File.Top): inside a wrapped line's
+ // block its line stays and its row goes on.
+ .page_down => if (!past(pane, before.scroll, before.scroll_row) and before.scroll < @as(i32, @intCast(fx.lines)) - pane.rows)
return error.PageDidNotScroll,
- .wheel => if (pane.scroll() <= before.scroll and before.scroll < @as(i32, @intCast(fx.lines)) - pane.rows)
+ .wheel => if (!past(pane, before.scroll, before.scroll_row) and before.scroll < @as(i32, @intCast(fx.lines)) - pane.rows)
return error.WheelDidNotScroll,
.edit_char, .edit_twin => {
if (pane.file.?.content.len != before.len + 1 or pane.body.cur_row != before.row or pane.body.cur_col != before.col + 1)
@@ -1884,6 +1886,7 @@ fn seek(pane: *pardes.Pane, fx: Fixture, n: usize) void {
const span = @max(1, fx.lines * 8 / 10);
const row = fx.lines / 10 + (n *% 7919) % span;
f.scroll = @min(row, fx.lines -| 1);
+ f.scroll_row = 0;
f.syntax_dirty = true;
pane.body.cur_row = @intCast(f.scroll);
pane.body.cur_col = if (fx.cols > 200) @intCast(fx.cols * 3 / 4) else 0;
@@ -2401,3 +2404,8 @@ fn readFileAlloc(path: []const u8) ![]u8 {
}
return buf;
}
+
+/// Whether `pane`'s view's top is past (`line`, `row`).
+fn past(pane: *pardes.Pane, line: i32, row: u32) bool {
+ return pane.scroll() > line or (pane.scroll() == line and pane.file.?.scroll_row > row);
+}