diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 10:13:26 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 10:13:27 -0300 |
| commit | 0e3b4aa74a5969a3b8b298e9ffa3205399c9afdd (patch) | |
| tree | 0216fa23fdf186271e4690d9c517e583b1be7c74 /core/views.zig | |
| parent | 6d90badbf94dcee1c8a123153fb331b8c523c9f1 (diff) | |
| download | pardes-0e3b4aa74a5969a3b8b298e9ffa3205399c9afdd.tar.gz pardes-0e3b4aa74a5969a3b8b298e9ffa3205399c9afdd.zip | |
Core, layout, draw: the band starts on the row under the head's last, in the rows the tag keeps from rest, and no spine hangs where no band row is (UX D5 as E3 amends it, DESIGN.md E5.2: "there is never a blank row between a head and its rows"; "no stub `│` in a kept row under a prompt"): a pane whose tag takes two rows at rest showed `SPC ?`'s one-row head, a blank row with spines, then the band (P1-L 03/04, P2-L 02/03); TESTS FIRST: Band.zig "a narrow band gives way ... the band starts on the row under the head, in the rows the tag keeps from rest" (44 columns, a tag of 2 rows at rest, Help for SPC l: on the base the tag's own rows 2 (`expected 1, found 2`), the band from its third row) and "out of rest with no band, the rows a tag keeps from rest stay blank: a spine hangs only where a band row is" (`/` in the same pane: on the base a `│` under the key cell in the kept row); THE CHANGE: Core.sync lays a host's tag out as the head's own rows (a terminal's: the rows at rest, as before), and a band of B rows takes the rows kept from rest first: `band_rows = max(B, kept - head)`, `tag_rows = max(kept, head + band_rows)` (body offset = max(rest rows, head rows + band rows), E3), so the band (drawn from `tag_rows - band_rows`, draw.joinBand, and read there by mouse.zig) starts under the head and its ground runs down through the kept rows; with no band the tag keeps its rows from rest, blank: draw.paintPaneTag's spines in the kept rows (P1's reading 6, E4: "no band no spine") are deleted; layout.floorRows works the band's pane's top out from the state as sync will lay it, `max(rows at rest, head rows + band)` (layout.headRows: the prefix out of rest and the head, wrapped as sync wraps them), where it read the last sync's rows (`tag_rows - band_rows + band`): the first layout after a head changed (a level's band opening) read the rows of the one before, and the next key would have moved the body by the kept rows; so that it can wrap at the pane's width, layout.compute gives each pane its column's x and width before it works out the heights (no rect had one while the floors were asked); the views.zig soak test now holds its band short under a picker's head and act row (2 rows: Find in the pane itself at 40x12: band 2 of 3, tag rows 4; the old load's `min(takes, tag_rows - 1)` would say 3): under SPC's one-row head the kept row is the band's now, and a head of one row never told the two apart; TagState's "a tag out of rest keeps its rows at rest at least" asks the new geometry (the head's own row, the body giving only what the band takes past the kept rows); GOLDEN: fsearch `nomatch`: the `│` under `/` in the kept row 17 is gone (a prompt with no band); no other golden moved; a band over a terminal or a kind's pane still starts under the rows the tag keeps (their tag is their rest rows, the pty and the view never resized); core-test 1086/1257 (171 skipped), process-test 1 of 147 failed before the golden (fsearch, regenerated)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/views.zig')
| -rw-r--r-- | core/views.zig | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/core/views.zig b/core/views.zig index 02628e63..a81e8430 100644 --- a/core/views.zig +++ b/core/views.zig @@ -611,26 +611,35 @@ test "a view not live with its band open, dumped and loaded, draws before its ne _ = try drawOne(q, 0, .{ .ctx = null, .f = null }); } -test "a band its sync held short under a tag of two rows, dumped and loaded: its rows are the never-loaded session's, and so is the next layout" { +test "a band its sync held short under a head of two rows, dumped and loaded: its rows are the never-loaded session's, and so is the next layout" { const gpa = std.testing.allocator; const dump = @import("dump.zig"); - const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 18 }); + const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); defer p.deinit(); + p.settings.jumps = .walk; + var tmp = std.testing.tmpDir(.{}); + defer tmp.cleanup(); + try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "alpha.zig", .data = "const alpha = 1;\n" }); + var dir_buf: [std.Io.Dir.max_path_bytes]u8 = undefined; + const dir = dir_buf[0..try tmp.dir.realPath(std.testing.io, &dir_buf)]; const pane = try p.setTestFile("one\n"); + gpa.free(pane.file.?.path); + pane.file.?.path = try std.Io.Dir.path.join(gpa, &.{ dir, "one.txt" }); const host = p.view().active; p.newScratchBelow(host); const low = p.view().active; p.view().active = host; p.sync(); - p.update(.{ .key = .{ .cp = ' ' } }); - p.update(.{ .key = .{ .cp = Key.down } }); - // The column has not the rows: the band is held under what it wants, - // under a tag of two rows of its own. + // Find in the pane itself (it reads): its head and its act row over + // the band, which the short column holds under what it wants. + p.stream.engine = .walk; + pardes.Pick.open(p, host, .find, "", "", ""); + p.sync(); try testing.expect(pane.band_rows > 0 and pane.band_rows < pardes.Band.takes(p, host)); try testing.expect(pane.tag_rows - pane.band_rows >= 2); const bytes = try dump.byteDump(p); defer gpa.free(bytes); - const q = try dump.load(gpa, .{ .tty_only = true, .cols = 40, .rows = 18 }, bytes, null); + const q = try dump.load(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }, bytes, null); defer q.deinit(); try testing.expectEqual(pane.band_rows, q.panes[host].?.band_rows); // The next step lays the column out from the band's floor (layout |
