From ebdcc64d7f8735224a486e93f3ed4a0cb56cd653 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 19:35:33 -0300 Subject: A dump holds every column a session may, 16, not 6 Dump of a session with more than 6 columns failed bad dump columns, since dump.zig's max_cols was 6 while a session holds MAX_COLS. It is MAX_COLS now; the limit's lines in docs/fs.md and docs/divergences.md go. Co-Authored-By: Claude Opus 5.5 --- docs/divergences.md | 2 -- docs/fs.md | 1 - src/dump.zig | 20 +++++++++++++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/divergences.md b/docs/divergences.md index 6560368c..17179029 100644 --- a/docs/divergences.md +++ b/docs/divergences.md @@ -18,8 +18,6 @@ moving a bookmark does not quietly orphan work or hide a failure. ## Known wrong on `main` -- `Dump` of a session with more than 6 columns fails `Dump: bad dump - columns` (`src/dump.zig` `max_cols` is 6; a session holds 16). - `pardes FILE` in a pane forwards only a FILE that exists; a new file name starts a separate editor instead of opening a pane in the session. - `Dump` fails `no such directory` when the default `DumpDir`'s parent diff --git a/docs/fs.md b/docs/fs.md index e4750690..2e2f1453 100644 --- a/docs/fs.md +++ b/docs/fs.md @@ -646,7 +646,6 @@ become spaces. | undo | 256 steps | | log | 64 KiB ring; `msg` 256 bytes, `err` reason 200 | | `pty/run` output | 64 KiB | -| a dump | 6 columns (so `Dump` of more fails `bad dump columns`) | | file name component | 255 bytes | ## Source and tests diff --git a/src/dump.zig b/src/dump.zig index fca88a2d..194c1ed3 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -129,7 +129,7 @@ pub fn defaultDirectory(buf: []u8) ?[]const u8 { pub const magic = "pardes-dump"; pub const version: u32 = 1; pub const max_panes: usize = MAX_PANES; -pub const max_cols: usize = 6; +pub const max_cols: usize = MAX_COLS; /// Output arguments are typed in the same bounded one-line tag storage. Keep /// the schema limit named independently so a dump reader can validate it /// without importing the output-pane implementation. The bound itself is @@ -987,6 +987,24 @@ test "a dump keeps the settings that differ from a fresh session's, and a restor try std.testing.expect(!restored.settings.verbose); } +test "a session with every column it may hold dumps and restores them all" { + const gpa = std.testing.allocator; + const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 1200, .rows = 24 }); + defer p.deinit(); + while (p.ncol < MAX_COLS) { + layout.compute(p); + var widest: usize = 0; + for (0..p.ncol) |c| if (p.col_w[c] > p.col_w[widest]) { + widest = c; + }; + _ = layout.insertColumn(p, widest, false) orelse return error.NoColumn; + } + try dumpState(p); + const restored = try initFromDump(gpa, .{ .tty_only = true, .cols = 1200, .rows = 24 }, p.dump_out.?); + defer restored.deinit(); + try std.testing.expectEqual(@as(usize, MAX_COLS), restored.ncol); +} + test "a restored pane keeps its dot, as acme's dump keeps a window's" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); -- cgit v1.3