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