diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 01:43:24 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 01:43:40 -0300 |
| commit | ed05c825102ebce7cd1e314226a1c88b8658baef (patch) | |
| tree | 41957f9fb7c5df11389d7872079c6494f47af5ce /test | |
| parent | 0252c830daf6184a9faefa32a7d1f384f5a86b94 (diff) | |
| parent | 59b6ac1bae9cb6720252e1c3e1cc9d4f3a8ab3b1 (diff) | |
| download | pardes-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')
| -rw-r--r-- | test/daemon.py | 2 | ||||
| -rw-r--r-- | test/kitty.zig | 2 | ||||
| -rw-r--r-- | test/panes.zig | 28 | ||||
| -rw-r--r-- | test/perf.zig | 14 | ||||
| -rw-r--r-- | test/process/tty_boot.zig | 7 | ||||
| -rw-r--r-- | test/snapshots/builtins.golden | 71 | ||||
| -rw-r--r-- | test/snapshots/leader.golden | 75 | ||||
| -rw-r--r-- | test/terminal.zig | 2 |
8 files changed, 106 insertions, 95 deletions
diff --git a/test/daemon.py b/test/daemon.py index c465b52f..adfbc52a 100644 --- a/test/daemon.py +++ b/test/daemon.py @@ -328,7 +328,7 @@ class Replica: """A replica's connection (abi/wire.zig): length-prefixed messages, a tag byte and a little-endian u32 length. It is a near client: its first word after the hello says so.""" - WIRE = 34 + WIRE = 35 def __init__(self, path, timeout=10): self.path, self.timeout = path, timeout diff --git a/test/kitty.zig b/test/kitty.zig index 0bd849c2..37e64949 100644 --- a/test/kitty.zig +++ b/test/kitty.zig @@ -1224,7 +1224,7 @@ test "kitty: scrolled back by pardes, an image shows on its row; scrolled forwar r.feed(0, &nl); try std.testing.expectEqual(@as(usize, 0), (try r.placesOf(20)).len); // Back to the top of the history: the marker row is the body's first. - pane.scrollBy(-1000); + pane.scrollBy(pardes.config.tab_width, -1000); const o = r.origin(0); const drawn = try r.placesOf(20); try std.testing.expectEqual(@as(usize, 1), drawn.len); diff --git a/test/panes.zig b/test/panes.zig index bd39beba..eea4b36d 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -157,7 +157,7 @@ const BodyHitTests = struct { p.view().row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); - pane.scrollBy(10); + pane.scrollBy(pardes.config.tab_width, 10); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); p.sync(); @@ -205,7 +205,7 @@ const LineNumberLookTests = struct { p.view().row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); - pane.scrollBy(30); + pane.scrollBy(pardes.config.tab_width, 30); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); p.sync(); @@ -219,7 +219,7 @@ const LineNumberLookTests = struct { const rows = [_]u16{ 1, pane.context_rows + 3 }; for (rows) |row| { // Each Look recentres the view; come back under the headers. - pane.scrollBy(30 - pane.scroll()); + pane.scrollBy(pardes.config.tab_width, 30 - pane.scroll()); _ = frame.reset(.retain_capacity); _ = try p.render(frame.allocator()); const expected = pane.wrapAt(config.tab_width, row).line; @@ -262,7 +262,7 @@ const TreeContextTests = struct { const pane = try setZigFile(p, "const Box = struct {\n\n // omitted member comment\n\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([30][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); p.view().row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); - pane.scrollBy(10); + pane.scrollBy(pardes.config.tab_width, 10); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); p.sync(); @@ -278,7 +278,7 @@ const TreeContextTests = struct { // A one-pixel separator remains inside its existing header row. try std.testing.expectEqual(row, layer.bodyHit(x, y, 10, 20, 8, 10).?.row); } - pane.scrollBy(-5); + pane.scrollBy(pardes.config.tab_width, -5); _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 2), layer.context_rows); try std.testing.expect(layer.hasContextBorderAfter(0)); @@ -317,7 +317,7 @@ const TreeContextTests = struct { const pane = try setZigFile(p, source); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); - pane.scrollBy(7); + pane.scrollBy(pardes.config.tab_width, 7); p.sync(); _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 0), pane.context_rows); @@ -348,7 +348,7 @@ const TreeContextTests = struct { p.update(.{ .key = .{ .cp = Key.escape } }); var previous: u16 = pane.context_rows; while (pane.scroll() > 0) { - pane.scrollBy(-1); + pane.scrollBy(pardes.config.tab_width, -1); _ = try p.render(frame.allocator()); try std.testing.expect(pane.context_rows <= previous); previous = pane.context_rows; @@ -357,7 +357,7 @@ const TreeContextTests = struct { try std.testing.expectEqual(@as(u16, 0), pane.context_rows); try std.testing.expectEqual(@as(i32, 0), pane.wrapRow(config.tab_width, 0, pane.body.cur_col).row); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); - pane.scrollBy(7); + pane.scrollBy(pardes.config.tab_width, 7); _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 0), pane.context_rows); } @@ -370,7 +370,7 @@ const TreeContextTests = struct { p.sync(); p.settings.wrap = false; try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); - pane.scrollBy(8); + pane.scrollBy(pardes.config.tab_width, 8); pane.hscroll = 4; var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); @@ -409,7 +409,9 @@ const TreeContextTests = struct { p.sync(); p.settings.wrap = true; try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); - pane.scrollBy(2); + // The view's top on line 2 (a scroll's rows would stop in line 0's + // three: File.Top). + panes.File.setTop(pane, .{ .line = 2 }); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); p.sync(); @@ -994,7 +996,7 @@ test "terminal output keeps following new rows after scrollback eviction" { for (0..3) |phase| { if (phase > 0) { pane.body.mode = .normal; - pane.scrollBy(-30); + pane.scrollBy(pardes.config.tab_width, -30); try std.testing.expect(pane.termTop() < pages.scrollbar().total - pane.rows); pardes.keys.enterTty(p, 0); } @@ -2032,7 +2034,7 @@ const OutputTests = struct { try std.testing.expectEqual(next, panes.Output.nextResult(restored_file.content, restored_file.location_rows, path, .{ .line = 2, .col = 5 })); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); - result.scrollBy(-1000); + result.scrollBy(pardes.config.tab_width, -1000); layout.compute(p); const surface = try p.render(frame.allocator()); const rect = p.view().rects[pane.search_pane.?]; @@ -2690,7 +2692,7 @@ const TerminalTests = struct { p.update(.{ .output = .{ .pane = .at(0), .bytes = bytes } }); } p.shell_rows.stale = true; - pane.scrollBy(-20); + pane.scrollBy(pardes.config.tab_width, -20); // ONE buffer line standing in for SIX shell rows: everything below slides // UP five, so the last rows of the body resolve past the viewport's bottom 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); +} diff --git a/test/process/tty_boot.zig b/test/process/tty_boot.zig index 6373de84..01b35a24 100644 --- a/test/process/tty_boot.zig +++ b/test/process/tty_boot.zig @@ -130,14 +130,17 @@ fn builtins(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.key("/"); try t.send("^ +Look "); try t.key("enter"); + // Look's row and its documentation under it (the margin below the row + // a search lands on is `scroll_off` rows, and Look's documentation + // wraps: Exec's row is under the body). try t.wait(10000, "Look enter, right-click"); - try t.wait(10000, "Exec tab, middle-click"); + try t.wait(10000, "Look at its argument as B3 does"); try t.stable(700, 15000); // n moves through look-able text; it must not execute command names. try t.key("space j n space j n space j n"); try t.wait(10000, "Look enter, right-click"); - try t.wait(10000, "Exec tab, middle-click"); + try t.wait(10000, "Look at its argument as B3 does"); try t.key("space c ?"); try t.wait(10000, "under SPC c"); try t.wait(10000, "Joincol"); diff --git a/test/snapshots/builtins.golden b/test/snapshots/builtins.golden index 6d5739ef..e9786c8a 100644 --- a/test/snapshots/builtins.golden +++ b/test/snapshots/builtins.golden @@ -55,40 +55,39 @@ |28: |29: |30: -== snap tutor-from-index grid=120x67 cursor=7,36 +== snap tutor-from-index grid=120x67 cursor=7,37 |10: 1 pardes builtins under SPC h Tutor -|25: +Search 1/1 Save Undock Del -|26: /^ +Look -|27: @p2:220:1 Look enter, right-click -|35: /tmp/pardes-snap/builtins/cwd/+Tutor Save Term Collapse Follow Del -|36: 1 -|37: 2 PARDES TUTOR -|38: 3 -|39: 4 This pane is +Tutor, a copy: edit it freely; there is no need to -|40: 5 Save it (a bare Save asks for a path to write a copy to). -|41: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses -|42: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a -|43: 8 fresh copy. -|44: 9 -|45: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part. -|46: 11 Each lesson is a few things to do, then names its guide section. -|47: 12 Words in backticks, like `Save`, are builtins. -|48: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a -|49: 14 shell line; `Look` (B3) opens what the text names, or else finds -|50: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with -|51: 16 "| " are tags. -|52: 17 -|53: 18 Press j until you reach part 1. -|54: 19 -|55: 20 -|56: 21 ================================================================= -|57: 22 = PART 1 — MODES = -|58: 23 ================================================================= -|59: 24 -|60: 25 1. The box left of this pane's tag is blank, so you are in -|61: 26 NORMAL mode. Press i: it shows ^ (INSERT). Type a word, then -|62: 27 Esc: blank again. -|63: 28 2. Press Esc once more, in NORMAL: the keyboard goes back to the -|64: 29 pane you were in before (not what helix does). Come back with -|65: 30 Esc again. -|66: 31 3. Press Alt-n: a terminal opens, in NORMAL mode, and pardes types +|26: +Search 1/1 Save Undock Del +|27: /^ +Look +|28: @p2:220:1 Look enter, right-click +|36: /tmp/pardes-snap/builtins/cwd/+Tutor Save Term Collapse Follow Del +|37: 1 +|38: 2 PARDES TUTOR +|39: 3 +|40: 4 This pane is +Tutor, a copy: edit it freely; there is no need to +|41: 5 Save it (a bare Save asks for a path to write a copy to). +|42: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses +|43: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a +|44: 8 fresh copy. +|45: 9 +|46: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part. +|47: 11 Each lesson is a few things to do, then names its guide section. +|48: 12 Words in backticks, like `Save`, are builtins. +|49: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a +|50: 14 shell line; `Look` (B3) opens what the text names, or else finds +|51: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with +|52: 16 "| " are tags. +|53: 17 +|54: 18 Press j until you reach part 1. +|55: 19 +|56: 20 +|57: 21 ================================================================= +|58: 22 = PART 1 — MODES = +|59: 23 ================================================================= +|60: 24 +|61: 25 1. The box left of this pane's tag is blank, so you are in +|62: 26 NORMAL mode. Press i: it shows ^ (INSERT). Type a word, then +|63: 27 Esc: blank again. +|64: 28 2. Press Esc once more, in NORMAL: the keyboard goes back to the +|65: 29 pane you were in before (not what helix does). Come back with +|66: 30 Esc again. diff --git a/test/snapshots/leader.golden b/test/snapshots/leader.golden index 1bd0bb41..9f523992 100644 --- a/test/snapshots/leader.golden +++ b/test/snapshots/leader.golden @@ -27,28 +27,27 @@ |20: 14 Open the tutor, a document to work through. |21: 15 |22: ~ -== snap tutor grid=100x41 cursor=7,22 +== snap tutor grid=100x41 cursor=7,23 |6: 1 pardes builtins under SPC h Tutor -|21: /tmp/pardes-snap/leader/cwd/+Tutor Save Term Collapse Follow Del -|22: 1 -|23: 2 PARDES TUTOR -|24: 3 -|25: 4 This pane is +Tutor, a copy: edit it freely; there is no need to -|26: 5 Save it (a bare Save asks for a path to write a copy to). -|27: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses -|28: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a -|29: 8 fresh copy. -|30: 9 -|31: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part. -|32: 11 Each lesson is a few things to do, then names its guide section. -|33: 12 Words in backticks, like `Save`, are builtins. -|34: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a -|35: 14 shell line; `Look` (B3) opens what the text names, or else finds -|36: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with -|37: 16 "| " are tags. -|38: 17 -|39: 18 Press j until you reach part 1. -|40: 19 +|22: /tmp/pardes-snap/leader/cwd/+Tutor Save Term Collapse Follow Del +|23: 1 +|24: 2 PARDES TUTOR +|25: 3 +|26: 4 This pane is +Tutor, a copy: edit it freely; there is no need to +|27: 5 Save it (a bare Save asks for a path to write a copy to). +|28: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses +|29: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a +|30: 8 fresh copy. +|31: 9 +|32: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part. +|33: 11 Each lesson is a few things to do, then names its guide section. +|34: 12 Words in backticks, like `Save`, are builtins. +|35: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a +|36: 14 shell line; `Look` (B3) opens what the text names, or else finds +|37: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with +|38: 16 "| " are tags. +|39: 17 +|40: 18 Press j until you reach part 1. == snap deleted grid=100x41 cursor=7,3 |5: |6: @@ -69,23 +68,23 @@ |21: |22: |23: -|24: -|25: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Follow Del -|26: 1 pardes builtins under SPC h -|27: 2 -|28: 3 SPC h b Build -|29: 4 Show this build in a +Build: its version, compiler, optimize mode, target and dependencies. -|30: 5 A stamped build's (a release, or the ~/.local install) commit, jj change and build time too,↩ -|31: its platform, its grammars, and whether the addons are compiled in. -|32: 6 -|33: 7 SPC h c Changelog topbar -|34: 8 Show this build's version and what changed to reach it, in a +Changelog. -|35: 9 -|36: 10 SPC h m Messages -|37: 11 Show the messages said so far in a +Messages. -|38: 12 -|39: 13 SPC h t Tutor topbar -|40: 14 Open the tutor, a document to work through. +|24: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Follow Del +|25: 1 pardes builtins under SPC h +|26: 2 +|27: 3 SPC h b Build +|28: 4 Show this build in a +Build: its version, compiler, optimize mode, target and dependencies. +|29: 5 A stamped build's (a release, or the ~/.local install) commit, jj change and build time too,↩ +|30: its platform, its grammars, and whether the addons are compiled in. +|31: 6 +|32: 7 SPC h c Changelog topbar +|33: 8 Show this build's version and what changed to reach it, in a +Changelog. +|34: 9 +|35: 10 SPC h m Messages +|36: 11 Show the messages said so far in a +Messages. +|37: 12 +|38: 13 SPC h t Tutor topbar +|39: 14 Open the tutor, a document to work through. +|40: 15 == snap help-column grid=100x41 cursor=7,6 |5: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Follow Del |6: 1 pardes builtins under SPC c diff --git a/test/terminal.zig b/test/terminal.zig index 03bcd294..2873c278 100644 --- a/test/terminal.zig +++ b/test/terminal.zig @@ -107,7 +107,7 @@ test "document construction allocates only the pane and has inert terminal defau try std.testing.expectEqual(Term.Grid{}, grid(pane.terminal)); try std.testing.expectEqual(Term.Modes{}, modes(pane.terminal)); try std.testing.expectEqual(Term.Prompt{}, prompt(pane.terminal)); - pane.scrollBy(100); + pane.scrollBy(pardes.config.tab_width, 100); pane.followOutput(); pane.resizeGrid(undefined, 80, 24); // no terminal: the core is never read try std.testing.expectEqual(Term.Grid{}, grid(pane.terminal)); |
